GlobalSearchScope (@NotNull Project project, boolean withSubdirectories, @NotNull VirtualFile directory) { Set<VirtualFile> result = new LinkedHashSet<>(); result.add(directory); addSourceDirectoriesFromLibraries(project, directory, result); VirtualFile[] array = result.toArray(VirtualFile.EMPTY_ARRAY); return GlobalSearchScopesCore.directoriesScope(project, withSubdirectories, array); }