void (@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { final StructuralSearchDialog dialog = parameters.getEditor().getUserData(StructuralSearchDialogKeys.STRUCTURAL_SEARCH_DIALOG); if (dialog == null) { final Boolean test = parameters.getEditor().getUserData(StructuralSearchDialogKeys.TEST_STRUCTURAL_SEARCH_DIALOG); if (test == null || !test) return; } final Document document = parameters.getEditor().getDocument(); final int end = parameters.getOffset(); final int line = document.getLineNumber(end); final int start = document.getLineStartOffset(line); String shortPrefix = TextFieldWithAutoCompletionListProvider.getCompletionPrefix(parameters); final CharSequence text = document.getCharsSequence(); if (StringUtil.startsWithChar(shortPrefix, '$')) { shortPrefix = shortPrefix.substring(1); Set<String> variableNames = TemplateImplUtil.parseVariableNames(text); for (String name : variableNames) { if (name.startsWith(shortPrefix) && !name.equals(shortPrefix)) { result.addElement(LookupElementBuilder.create('$' + name + '$') .withInsertHandler((context, item) -> { final int offset = context.getTailOffset(); if (text.length() > offset + 1) { final char c = text.charAt(offset); if (c == '$') { document.deleteString(offset, offset + 1); } } })); } } } final String prefix = parameters.isExtendedCompletion() ? shortPrefix : text.subSequence(start, end).toString(); if (StringUtil.containsChar(prefix, '$')) { return; } result.runRemainingContributors(parameters, cr -> { if (cr.getLookupElement().getObject() instanceof String) return; result.passResult(cr); }); CompletionResultSet insensitive = result.withPrefixMatcher(new CamelHumpMatcher(prefix)); ConfigurationManager configurationManager = ConfigurationManager.getInstance(parameters.getPosition().getProject()); for (Configuration configuration: configurationManager.getAllConfigurations()) { LookupElementBuilder element = LookupElementBuilder.create(configuration, configuration.getMatchOptions().getSearchPattern()) .withLookupString(configuration.getName()) .withTypeText(configuration.getTypeText(), true) .withIcon(configuration.getIcon()) .withCaseSensitivity(false) .withPresentableText(configuration.getName()); if (dialog != null) element = element.withInsertHandler((InsertionContext context, LookupElement item) -> context.setLaterRunnable( () -> dialog.loadConfiguration((Configuration)item.getObject()) )); insensitive.addElement(element); } }