PsiFile (@NotNull Project project, @NotNull Editor editor) { final Document document = editor.getDocument(); final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); documentManager.commitDocument(document); return getRoot(documentManager.getPsiFile(document), editor); }