void (@NotNull PsiFile psiFile, @NotNull Consumer<? super PsiFile> checker) { checker.accept(psiFile); Document document = psiFile.getViewProvider().getDocument(); PsiDocumentManager manager = PsiDocumentManager.getInstance(psiFile.getProject()); if (document != null && manager.isUncommited(document)) { manager.commitDocument(document); checker.accept(manager.getPsiFile(document)); } }