void (@NotNull InsertionContext context, @NotNull LookupElement item) { if (shouldSelectAll) return; final Editor topLevelEditor = InjectedLanguageEditorUtil.getTopLevelEditor(context.getEditor()); final TemplateState templateState = TemplateManagerImpl.getTemplateState(topLevelEditor); if (templateState != null) { final TextRange range = templateState.getCurrentVariableRange(); if (range != null) { topLevelEditor.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), suggestion); } } }