void (@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) { EditorUtil.fillVirtualSpaceUntilCaret(editor); PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); int offset = editor.getCaretModel().getOffset(); List<TemplateImpl> applicableTemplates = TemplateManagerImpl.listApplicableTemplateWithInsertingDummyIdentifier( TemplateActionContext.expanding(file, editor)); Map<TemplateImpl, String> matchingTemplates = filterTemplatesByPrefix(applicableTemplates, editor, offset, false, true); MultiMap<String, CustomLiveTemplateLookupElement> customTemplatesLookupElements = getCustomTemplatesLookupItems(editor, file, offset); if (matchingTemplates.isEmpty()) { for (TemplateImpl template : applicableTemplates) { matchingTemplates.put(template, null); } } if (matchingTemplates.isEmpty() && customTemplatesLookupElements.isEmpty()) { if (!ApplicationManager.getApplication().isUnitTestMode()) { HintManager.getInstance().showErrorHint(editor, CodeInsightBundle.message("templates.no.defined")); } return; } showTemplatesLookup(project, editor, file, matchingTemplates, customTemplatesLookupElements); }