Skip to content

Autocomplete

The plugin provides the standard IntelliJ autocomplete actions.

The plugin provides an autocomplete mechanism. In applicable contexts, after typing first few characters of an entity name, the list of all applicable entities is shown, and using up down arrows the desired one can be added with a set of completion characters. These characters typically are, ., Enter, Tab, Control+Space, and in some cases also opening parenthesis.

The list is curated to include only entities applicable for such context. For example, when declaring a variable, only the list of types is shown after the :. After ., only methods applicable to the given builtin type, or permissions and obligations for the given protocol are displayed, along with their signature and return type. The plugin refines the argument and return type based on the information it has (receiver, type arguments, actual parameters). For example in the following snippet

function foo(x: List<Number>) returns Text {
    return x.map(function(x: Number) returns Text -> x.toText()).get(0).
}

only the methods applicable to Text are shown.

When a method is selected and autocompleted, applicable parentheses are inserted. The signature of the selected function is still shown as a tooltip above the call site. To show the parameter info on an arbitrary call, use View | Parameter Info.

Postfix templates

Dot completion

Postfix templates are items that show in autocomplete (that is, by pressing dot after an expression). These templates modify the receiver expression in a given way.

Live templates

Most language keywords have live templates.

This means that upon typing the first few characters of the keyword, it can be autocompleted with TAB, provided that it is typed within the applicable context. Along with the keyword itself, a template for the corresponding language construct is inserted. When this happens, the so-called "variables" of this template can be substituted with text, variable references or nested live templates. Cycling through the variables of the template is done using TAB and Shift-TAB.

The templates can be customised in Preferences | Live templates.

Auto import

For a names that are not defined in the current scope, the plugin searches additional files to find their declarations and offers importing them automatically.

Auto import

A hint balloon is displayed on top of an identifier that can be auto-imported. Pressing Alt + Enter either adds appropriate require statement if unambiguous, or displays a list of options if there are multiple source files defining the same symbol. When the import is unambiguous and Editor | General | Auto Import | Add unambiguous imports on the fly is checked, they will be added even without user's interaction (use with care).