void (final Project project, final Editor editor) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, file -> { int offset = editor.getCaretModel().getOffset(); PsiElement lastElement = InjectedLanguageUtil.findElementAtNoCommit(file, offset - 1); if (lastElement instanceof PsiFile) { //the very end of an injected file lastElement = file.findElementAt(offset - 1); } if (lastElement == null || !lastElement.isValid()) return false; if (doCompleteIfNeeded(offset, file, lastElement)) { return true; } FileViewProvider fileViewProvider = file.getViewProvider(); Language templateDataLanguage; final PsiElement parent = lastElement.getParent(); if (fileViewProvider instanceof TemplateLanguageFileViewProvider && (templateDataLanguage = ((TemplateLanguageFileViewProvider)fileViewProvider).getTemplateDataLanguage()) != parent.getLanguage()) { lastElement = fileViewProvider.findElementAt(offset - 1, templateDataLanguage); if (lastElement == null || !lastElement.isValid()) return false; return doCompleteIfNeeded(offset, file, lastElement); } return false; }); }