Reputation: 1494
Following the instructions here am building a custom language plugin, after generating A lexer class and registering it into the plugin.xml then running the project was expectiong to see the PsiViewer (Tools | PSI view Structure) but its not visible, the file extensions are recognized, actions registered are showing up but PsiViewer is not showing in the menu.Why ?
Even after struggling to show the PsiViewer am un able to debug my plugin language file as it does not show the properties/ file token.
What am i missing ?
I have tried installing the PsiViewer plugin even in the debugging version of Intellij Community and copying the flex files from some of the open source intellij plugin projects but it still does not seem to work.(even after fixing all the grammertical errors)
ADD. Here is Github Repo to a simplified version of the application
Upvotes: 1
Views: 431
Reputation: 23
If you do not have them installed, you need to have the IntelliJ IDEA Dev Kit plugin installed, and (if you're not writing your parser by hand), the Grammer-Kit plugin, which helps with making parsers.
To show the PSI Viewer when it won't show up otherwise, add "-Didea.is.internal=true" to the VM Options of the run configuration dialog ("Run->Edit Configurations..."). The PSI Viewer does not require a plugin:
Then, put focus on the editor (in your source file), and use the "Tools->View PSI Structure of Current File..." menu item. That will show the PSI viewer.
Your project is set up correctly to run, except that you have to add a new run configuration as a Plugin.
Beyond that, your parser description needs to quote all of the keywords. Unquoted words are "missing rules". For example, from the grammar description (BNF file) of your project:
FunctionDefinition ::= function IDENTIFIER '(' ')' (returns Type)? '{' FunctionBody '}'
should be:
FunctionDefinition ::= "function" IDENTIFIER '(' ')' ("returns" Type)? '{' FunctionBody '}'
Upvotes: 2