Editor (@NotNull DataContext dataContext, @NotNull Project project, boolean forUpdate) { Editor editor = getBaseEditor(dataContext, project); if (editor == null) return null; Document document = editor.getDocument(); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); PsiFile psiFile = documentManager.getCachedPsiFile(document); if (psiFile == null) return editor; if (!forUpdate) documentManager.commitDocument(document); int startLineOffset = DocumentUtil.getLineStartOffset(editor.getSelectionModel().getSelectionStart(), document); return InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, psiFile, startLineOffset); }