void (@NotNull String key, @NotNull CustomTemplateCallback callback) { //todo parse content and build template/templates TextMateService service = TextMateService.getInstance(); if (service != null) { SnippetsRegistry snippetsRegistry = service.getSnippetRegistry(); Editor editor = callback.getEditor(); TextMateScope scope = TextMateEditorUtils.getCurrentScopeSelector(((EditorEx)editor)); Collection<TextMateSnippet> snippets = snippetsRegistry.findSnippet(key, scope); if (snippets.size() > 1) { LookupImpl lookup = (LookupImpl)LookupManager.getInstance(callback.getProject()) .createLookup(editor, LookupElement.EMPTY_ARRAY, "", new LookupArranger.DefaultArranger()); for (TextMateSnippet snippet : snippets) { lookup.addItem(new TextMateSnippetLookupElement(snippet), new PlainPrefixMatcher(key)); } Project project = editor.getProject(); lookup.addLookupListener(new MyLookupAdapter(project, editor, callback.getFile())); lookup.refreshUi(false, true); lookup.showLookup(); } else if (snippets.size() == 1) { TextMateSnippet snippet = ContainerUtil.getFirstItem(snippets); assert snippet != null; expand(editor, snippet); } } }