private static PsiFile resolveFile(@NotNull VirtualFile file,
                                     @NotNull Project project) {
    if (project.isDisposed() || !file.isValid()) return null;
    return PsiManager.getInstance(project).findFile(file);
  }
private static PsiFile resolveFile(@NotNull VirtualFile file,
                                     @NotNull Project project)