void (@NotNull GroovyFile file) { final Document document = PsiDocumentManager.getInstance(myProject).getDocument(file); PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(file.getProject()); LOG.assertTrue(document != null); psiDocumentManager.commitDocument(document); LOG.assertTrue(file.isValid()); }