static @Nullable AreaInstance findArea(@NotNull VirtualFile file, @Nullable Project project) {
    checkCanceled(); // ProcessCanceledException if current task is interrupted
    if (project == null || project.isDisposed() || !file.isValid()) return null;
    if (FileTypeRegistry.getInstance().isFileIgnored(file)) return null; // hide ignored files
    if (ScratchFileService.getInstance().getRootType(file) != null) return ApplicationManager.getApplication();
    Module module = ProjectFileIndex.getInstance(project).getModuleForFile(file, false);
    if (module != null) return module.isDisposed() ? null : module;
    if (!is("projectView.show.base.dir")) return null;
    VirtualFile ancestor = findBaseDir(project);
    // file does not belong to any content root, but it is located under the project directory
    return ancestor == null || !isAncestor(ancestor, file, false) ? null : project;
  }
static @Nullable AreaInstance findArea(@NotNull VirtualFile file, @Nullable Project project)