From 3acffaa01b599e2be1772552b236ec3c2ab89327 Mon Sep 17 00:00:00 2001 From: Ruslan Cheremin Date: Thu, 8 May 2025 20:48:19 +0200 Subject: [PATCH] [indexes][cleanup] IJPL-188: aftermath a bit of docs and renaming GitOrigin-RevId: bf731040b3bd9ec43eda0e4b64baa1d32f38d8f9 --- .../intellij/find/impl/FindInProjectTask.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java index e403e62fba5e..4c4c6d568a21 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectTask.java @@ -549,37 +549,36 @@ final class FindInProjectTask { private @NotNull List collectSearchItems() { SearchScope customScope = findModel.isCustomScope() ? findModel.getCustomScope() : null; - List searchTasks = new ArrayList<>(); - //fill the list from _one of_ {customScope | directory | module | indexingProviders } + FindModelExtensions: + List searchItems = new ArrayList<>(); + //fill the list from _one of_ {customScope | directory | module | indexingProviders} + FindModelExtensions: + //so the resulting list is of { VirtualFile | IndexableFilesIterator | FindModelExtension } if (customScope instanceof LocalSearchScope localSearchScope) { - searchTasks.addAll(GlobalSearchScopeUtil.getLocalScopeFiles(localSearchScope)); + searchItems.addAll(GlobalSearchScopeUtil.getLocalScopeFiles(localSearchScope)); } else if (customScope instanceof VirtualFileEnumeration virtualFileEnumeration) { // GlobalSearchScope can include files out of project roots e.g., FileScope / FilesScope - ContainerUtil.addAll(searchTasks, FileBasedIndexEx.toFileIterable(virtualFileEnumeration.asArray())); + ContainerUtil.addAll(searchItems, FileBasedIndexEx.toFileIterable(virtualFileEnumeration.asArray())); } else if (directoryToSearchIn != null) { boolean withSubdirs = findModel.isWithSubdirectories(); - searchTasks.addAll(withSubdirs ? List.of(directoryToSearchIn) : List.of(directoryToSearchIn.getChildren())); + searchItems.addAll(withSubdirs ? List.of(directoryToSearchIn) : List.of(directoryToSearchIn.getChildren())); } else if (moduleToSearchIn != null) { EntityStorage storage = WorkspaceModel.getInstance(project).getCurrentSnapshot(); ModuleEntity moduleEntity = Objects.requireNonNull(storage.resolve(new ModuleId(moduleToSearchIn.getName()))); - searchTasks.addAll(IndexableEntityProviderMethods.INSTANCE.createIterators(moduleEntity, storage, project)); + searchItems.addAll(IndexableEntityProviderMethods.INSTANCE.createIterators(moduleEntity, storage, project)); } else { FileBasedIndexEx indexes = (FileBasedIndexEx)FileBasedIndex.getInstance(); - searchTasks.addAll(indexes.getIndexableFilesProviders(project)); + searchItems.addAll(indexes.getIndexableFilesProviders(project)); } - searchTasks.addAll(FindModelExtension.EP_NAME.getExtensionList()); + searchItems.addAll(FindModelExtension.EP_NAME.getExtensionList()); - return searchTasks; + return searchItems; } - /** - * @return filesToScanInitially + candidate files found by searchers, filtered by fileMaskFilter - */ + /** @return candidate files found by searchers, filtered by fileMaskFilter */ private static @NotNull Set collectFiles(@NotNull FindInProjectSearcher @NotNull [] searchers, @NotNull Predicate fileFilter) { Set resultFiles = VfsUtilCore.createCompactVirtualFileSet();