Skip to content
This repository was archived by the owner on Nov 10, 2018. It is now read-only.

Performance considerations

Tim Seckinger edited this page Jan 12, 2017 · 6 revisions

LookupElements-only execution

For each template insertion, IntelliJ will evaluate the macro multiple times, once to determine the completion suggestions (LookupElements) and (for some reason) four times to determine the Result to insert into the editor.

If your script performs expensive operations, you may want to skip Result calculation and only generate LookupElements. This can be accomplished using the _goal variable that will either be "RESULT" or "LOOKUP_ELEMENTS" to find out what the current evaluation is for.

Example (Groovy):

if (_goal == 'LOOKUP_ELEMENTS') {
    java.util.stream.LongStream.range(0, 999999999).sum() // Expensive operation
} else {
    ''
}

Clone this wiki locally