boolean (@NotNull Caret hostCaret) { Editor editor = hostCaret.getEditor(); Project project = editor.getProject(); if (project != null && InjectedLanguageManager.getInstance(project).mightHaveInjectedFragmentAtOffset(editor.getDocument(), hostCaret.getOffset())) { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); return true; } return false; }