private static @NotNull Document getDocumentForNonPhysicalFile(PsiFile file) {
    Document document = file.getViewProvider().getDocument();
    if (document != null && document.getTextLength() == file.getTextLength()) {
      return document;
    }
    return new DocumentImpl(file.getText(), true);
  }
private static @NotNull Document getDocumentForNonPhysicalFile(PsiFile file)