private void ensureDocumentCommitted(@NotNull PsiFile file) {
    final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
    Document document = documentManager.getDocument(file);
    if (document != null) {
      documentManager.commitDocument(document);
    }
  }
private void ensureDocumentCommitted(@NotNull PsiFile file)