13. Go To Symbol Contributor
A Go to Symbol Contributor helps the user to navigate to any PSI element by its name.
Define a Helper Method for Generated PSI Elements
To specify how a PSI element looks like in the popup window, Structure tool window, or other components, it should implement getPresentation(). This method gets defined in the utility class SimplePsiImplUtil, and the parser and PSI classes must be regenerated. Add the following method to SimplePsiImplUtil:
Update Grammar and Regenerate the Parser
Now add the SimplePsiImplUtil.getPresentation() to the property methods definition in the Simple.bnf grammar file by replacing the property definition with the lines below. Don't forget to regenerate the parser after updating the file! Right-click on the Simple.bnf file and select Generate Parser Code.
Define a Go To Symbol Contributor
To contribute items to results, subclass ChooseByNameContributor to create SimpleChooseByNameContributor:
Register the Go To Symbol Contributor
The SimpleChooseByNameContributor implementation is registered with the IntelliJ Platform in the plugin configuration file using the com.intellij.gotoSymbolContributor extension point.
Run the Project
Run the plugin by using the Gradle runIde task.
The IDE now supports navigating to a property definition by name pattern via action.
