IntelliJ Platform Plugin SDK
 
IntelliJ Platform Explorer

References and Resolve

Edit pageLast modified: 17 December 2024

One of the most important and tricky parts in implementing a custom language PSI is resolving references. Resolving references allows users to navigate from a PSI element usage (accessing a variable, calling a method, etc.) to the declaration of that element (the variable's definition, a method declaration, and so on).

This feature is required to support the Navigate | Declaration or Usages action invoked by Ctrl/Cmd+B or clicking the mouse button while holding Ctrl/Cmd key, and it is a prerequisite for implementing finding usages, rename refactoring, and code completion.

The View | Quick Definition action is based on the same mechanism, so it becomes automatically available for all references that can be resolved by the language plugin. To customize the exact document range to show in the popup (e.g., include "surrounding" code or comments), provide ImplementationTextSelectioner registered in com.intellij.lang.implementationTextSelectioner extension point.