GSF Diagnostic Tools

There is a separate module in the contrib repository, gsf.tools, which provides a number of tools in the Tools | GSF Development menu.

AST Viewer

The AST viewer is useful for examining your own parser's AST. Clicking in the editor will expose and select the corresponding AST node, and conversely, selecting an AST node will highlight the editor region corresponding to that AST node.

The AST viewer is described online here: http://wiki.netbeans.org/RubyAstViewer

NOTE: To support the AST viewer, your ParserResult must return a javax.swing.tree.TreeNode from the getAst() method.

Token Spy

The TokenSpy makes it easier to debug problems related to lexing. If you're wondering what the token hierarchy looks like for a given offset, open the TokenSpy. It will open a window which shows the current token id, text and length (as well as the top level embedded token id, text and length) for the caret offset. As you're moving the caret around, it shows the token state up to date.

Index Browser

The Lucene Index Browser lets you debug indexing and querying problems.



In the top left area, you get to choose the search key (there are some hardcoded ones there that I've used in Ruby and JavaScript, but it's an editable combobox so type any key you want). You also need to select which language index you want to search with the language combo box further to the right - it's currently set to Ruby. You can also choose what search type to use - it defaults to Prefix but you can search by exact name, or by a regular expression etc. Finally, you can enter a prefix or full name etc in the text field. Press enter to search.

This will list the set of search result matches in the list on the bottom left. Click on each result to see the full search result document on the bottom right. I've clicked on mymethod here, and you can see the full document on the right - e.g. the other [key,value] pairs from the document that contained your match. You can now for example compute the class that contained your method.

There is also a "open in Luke" button there. Behind the scenes, GSF is using the Lucene search engine to index and query the data, and Luke is a Lucene index browser. You can use this if you want to debug things down at the Lucene level. To do this, you have to place the luke-all.jar file in the NetBeans installation directory. If it's not there, clicking the button will tell you the exact path GSF is expecting it.


Tor Norbye <tor@netbeans.org>