GlobalSearchScope () { return new EverythingGlobalScope(myProject) { final FileBasedIndexImpl myFileBasedIndex; { boolean unitTestMode = ApplicationManager.getApplication().isUnitTestMode(); FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance(); // handle case of EmptyFileBasedIndex myFileBasedIndex = unitTestMode && !(fileBasedIndex instanceof FileBasedIndexImpl) ? null : (FileBasedIndexImpl)fileBasedIndex; } @Override public boolean contains(@NotNull VirtualFile file) { if (file instanceof VirtualFileWithId && myFileBasedIndex != null) { return myFileBasedIndex.belongsToProjectIndexableFiles(file, myProject); } RootType rootType = RootType.forFile(file); if (rootType != null && (rootType.isHidden() || rootType.isIgnored(myProject, file))) return false; return true; } }; }