private static boolean shouldUseMemoryStorage(@NotNull PsiFile file) {
    if (!(getVirtualFile(file) instanceof NewVirtualFile)) return true;

    PsiDocumentManager pdm = PsiDocumentManager.getInstance(file.getProject());
    Document document = pdm.getCachedDocument(file);
    return document != null && (pdm.isUncommited(document) || FileDocumentManager.getInstance().isDocumentUnsaved(document));
  }
private static boolean shouldUseMemoryStorage(@NotNull PsiFile file)