void (TemplateBuilderImpl builder) { MyTemplateListener templateListener = new MyTemplateListener(); int offset = myEditor.getCaretModel().getOffset(); Editor topLevelEditor = InjectedLanguageEditorUtil.getTopLevelEditor(myEditor); TextRange range = myScope.getTextRange(); assert range != null; RangeMarker rangeMarker = topLevelEditor.getDocument().createRangeMarker(range); Template template = builder.buildInlineTemplate(); template.setToShortenLongNames(false); template.setToReformat(false); myHighlighters = new ArrayList<>(); topLevelEditor.getCaretModel().moveToOffset(rangeMarker.getStartOffset()); TemplateManager.getInstance(myProject).startTemplate(topLevelEditor, template, templateListener); restoreOldCaretPositionAndSelection(myEditor, restoreCaretOffset(offset), this::restoreSelection); highlightTemplateVariables(template, topLevelEditor); TemplateState templateState = TemplateManagerImpl.getTemplateState(topLevelEditor); if (templateState != null) { DaemonCodeAnalyzer.getInstance(myProject).disableUpdateByTimer(templateState); } }