Skip to content

Navigation

Structure view

structure

For an opened file, an outline of the symbols defined in it can be obtained using View | Tool Windows | Structure. It shows a tree of all protocols, permissions, obligations, functions, structures in the currently opened file. The list can be filtered using the icons in the window's toolbar. All entities can be navigated to using double-clicking its name.

Go to declaration

The plugin lets you quickly navigate to the declaration of a symbol.

To quickly find the definition of an entity, position the caret on it and select Navigate | Declaration. This resolution works across files, respecting the require command.

The Go to declaration also works for builtin functions and methods. For this purpose, a set of read-only files containing the definitions is generated.

Find usages

The plugin lets you find all the usage sites of a symbol.

Right-click an identifier and select Find Usages. Alternatively, place caret on an identifier and press the Find Usages shortcut. You will be presented with a tool window listing all the usages. The display can be heavily customised in regard to grouping and filtering. By default, the items are grouped by the usage type (Value read, Struct field, Function call argument ...) and then by the source filename.

The Find usages window also shows you all places where the variable/type would be renamed using the Rename function.

Note: Report any irregularities in the list of usages (false positives, false negatives), as correctly working Find Usages is central to more advanced features not breaking the code.

Go to class/symbol

If you know the name of the symbol you want to navigate to, you can quickly do so using IntelliJ's "navigate to symbol" action.

All NPL files are indexed for definitions of various entities. This index happens on the background automatically - typically for the whole project during the project start, and for a file when it is edited. During construction of the indices, the IDE works in so-called "dumb mode", and various features are limited. Nevertheless, the indexing should normally take only couple seconds.

To make use of the index, you can invoke Navigate | Class or Navigate | Symbol and type prefix or a part of a name to list the top symbols. The distinction between Class and Symbol is that Class only navigates to structs, identifiers, symbols, and protocols, whereas symbol also includes permissions, obligations and functions.

Troubleshooting

If the index doesn't work correctly, you may try File | Invalidate Caches and Restart.