CPP-47417 [platform]: add WorkspaceFileKind.EXTERNAL_NON_INDEXABLE

Space-RevId: 02224f127daa7c1a5712fb07101b27dc0f6e4fce

GitOrigin-RevId: 1d4c9807baab256fed17e35eac5e913d02efbd10
This commit is contained in:
Tomas Husak
2026-02-03 14:27:14 +00:00
committed by intellij-monorepo-bot
parent 16f6fa1a95
commit dcf14b48fb
27 changed files with 106 additions and 69 deletions
@@ -207,7 +207,7 @@ public final class ResolveScopeManagerImpl extends ResolveScopeManager implement
var empty = projectFileIndex.findContainingLibraries(notNullVFile).isEmpty()
&& projectFileIndex.findContainingSdks(notNullVFile).isEmpty();
if (empty &&
(WorkspaceFileIndex.getInstance(myProject).findFileSet(notNullVFile, true, false, false, true, true, true) != null ||
(WorkspaceFileIndex.getInstance(myProject).findFileSet(notNullVFile, true, false, false, true, true, true, true) != null ||
myAdditionalIndexableFileSet.isInSet(notNullVFile))) {
return allScope;
}
@@ -189,7 +189,7 @@ class NonIndexableFilesSEContributor(event: AnActionEvent) : WeightedSearchEvery
private fun WorkspaceFileIndexEx.findNonIndexableFileSet(
file: VirtualFile,
): WorkspaceFileSet? = findFileSet(file, true, false, true, false, false, false)
): WorkspaceFileSet? = findFileSet(file, true, false, true, false, false, true, false)
private fun PsiManager.getPsiFileSystemItem(file: VirtualFile): PsiFileSystemItem? = when {
file.isDirectory -> ReadAction.nonBlocking<PsiDirectory?> { findDirectory(file) }.executeSynchronously()
@@ -58,7 +58,7 @@ private data class AllFileSets(val recursive: List<WorkspaceFileSet>, val nonRec
private fun WorkspaceFileIndex.allIndexableFileSets(root: VirtualFile): AllFileSets {
val indexableFileSets = runReadAction {
findFileSets(root, true, true, false, true, true, true)
findFileSets(root, true, true, false, true, true, false, true)
}
return indexableFileSets
.partition { fileSet -> fileSet !is WorkspaceFileSetWithCustomData<*> || fileSet.recursive }
@@ -67,7 +67,7 @@ private fun WorkspaceFileIndex.allIndexableFileSets(root: VirtualFile): AllFileS
private fun WorkspaceFileIndexEx.isExcludedOrInvalid(file: VirtualFile): Boolean {
val info = runReadAction {
getFileInfo(file, true, true, true, true, true, true)
getFileInfo(file, true, true, true, true, true, true, true)
}
return when (info) {
NonWorkspace.EXCLUDED -> true
@@ -102,7 +102,7 @@ public final class ReincludedRootsUtil {
VirtualFileUrlManager fileUrlManager = WorkspaceModel.getInstance(project).getVirtualFileUrlManager();
for (VirtualFile file : files) {
WorkspaceFileSet fileSet = ReadAction.nonBlocking(() -> {
return workspaceFileIndex.findFileSet(file, true, true, true, true, true, true);
return workspaceFileIndex.findFileSet(file, true, true, true, true, true, true, true);
}).expireWith(project).executeSynchronously();
if (fileSet == null) {
@@ -316,11 +316,11 @@ class IndexUpdateRunner(
val workspaceFileIndex = WorkspaceFileIndex.getInstance(project)
val excluded = readActionUndispatched {
val isIndexable = workspaceFileIndex.isIndexable(file)
val belongsToContentNonIndexable = workspaceFileIndex.findFileSet(file, true, false, includeContentNonIndexableSets = true, false, false, false) != null
val belongsToNonIndexable = workspaceFileIndex.findFileSet(file, true, false, includeContentNonIndexableSets = true, false, false, includeExternalNonIndexableSets = true, false) != null
// We don't want to just exclude all !isIndexable,
// because they may be contributed by an indexing contributor while WorkspaceFileIndex is not aware about it.
// We only want to exclude the files that are explicitly registered as non indexable.
ProjectRootManager.getInstance(project).fileIndex.isExcluded(file) || (!isIndexable && belongsToContentNonIndexable)
ProjectRootManager.getInstance(project).fileIndex.isExcluded(file) || (!isIndexable && belongsToNonIndexable)
}
if (excluded) {
val counter = badFileCounter.incrementAndGet()
@@ -154,6 +154,7 @@ class IndexingIteratorsProviderImpl(
includeContentNonIndexableSets = true,
includeExternalSets = false,
includeExternalSourceSets = false,
includeExternalNonIndexableSets = false,
includeCustomKindSets = false
)
return fileInfo.findFileSet { fileSet -> hasRecursiveRootFromModuleContent(fileSet, module) } != null
@@ -23,7 +23,7 @@ internal class ShowWorkspaceFileStateAction : DumbAwareAction() {
val fileSets = WorkspaceFileIndex
.getInstance(project)
.findFileSets(virtualFile, true, true, true, true, true, true)
.findFileSets(virtualFile, true, true, true, true, true, true, true)
val baseListPopupStep = object : BaseListPopupStep<WorkspaceFileSet>("Workspace File State", fileSets) {
override fun isSpeedSearchEnabled() = true
@@ -600,7 +600,7 @@ final class RefreshWorker {
for (Project openProject : ProjectManager.getInstance().getOpenProjects()) {
if (ReadAction.compute(() -> {
List<WorkspaceFileSet> indexableFileSet = WorkspaceFileIndex.getInstance(openProject)
.findFileSets(parent, true, true, /*includeContentNonIndexableSets*/ false, true, true, true);
.findFileSets(parent, true, true, /*includeContentNonIndexableSets*/ false, true, true, /*includeExternalNonIndexableSets*/ false, true);
return ContainerUtil.exists(indexableFileSet, set -> set instanceof WorkspaceFileSetWithCustomData && ((WorkspaceFileSetWithCustomData<?>)set).getRecursive());
})) {
return true;
@@ -76,7 +76,7 @@ class CustomKindFileSetTest {
assertFalse(module.moduleContentScope.contains(file))
assertFalse(module.moduleScope.contains(file))
assertIteratedContent(projectModel.project, mustNotContain = listOf(root, file))
val fileSet = fileIndex.findFileSet(file, true, true, true, true, true, true)
val fileSet = fileIndex.findFileSet(file, true, true, true, true, true, true, true)
assertNotNull(fileSet)
assertEquals(WorkspaceFileKind.CUSTOM, fileSet!!.kind)
}
@@ -79,7 +79,7 @@ class NonIndexableFileSetTest {
assertFalse(fileIndex.isIndexable(root))
assertTrue(projectFileIndex.isInProjectOrExcluded(file))
assertIteratedContent(projectModel.project, mustContain = listOf(root, file))
val fileSet = fileIndex.findFileSet(file, true, true, true, true, true, true)
val fileSet = fileIndex.findFileSet(file, true, true, true, true, true, true, true)
assertNotNull(fileSet)
assertEquals(WorkspaceFileKind.CONTENT_NON_INDEXABLE, fileSet!!.kind)
}
@@ -66,9 +66,9 @@ class NonRecursiveWorkspaceFileSetTest {
it.addEntity(NonRecursiveTestEntity(url, NonPersistentEntitySource))
}
readAction {
val fileSet = workspaceFileIndex.findFileSetWithCustomData(file, true, true, true, true, true, true, NonRecursiveFileCustomData::class.java)
val fileSet = workspaceFileIndex.findFileSetWithCustomData(file, true, true, true, true, true, true, true, NonRecursiveFileCustomData::class.java)
assertNull(fileSet)
val nonRecursiveDirFileSet = workspaceFileIndex.findFileSetWithCustomData(nonRecursiveDir, true, true, true, true, true, true, NonRecursiveFileCustomData::class.java)
val nonRecursiveDirFileSet = workspaceFileIndex.findFileSetWithCustomData(nonRecursiveDir, true, true, true, true, true, true, true, NonRecursiveFileCustomData::class.java)
assertNotNull(nonRecursiveDirFileSet)
}
}
@@ -89,9 +89,9 @@ class NonRecursiveWorkspaceFileSetTest {
it.addEntity(NonRecursiveTestEntity(url, NonPersistentEntitySource))
}
readAction {
val fileSet = workspaceFileIndex.findFileSetWithCustomData(file, true, true, true, true, true, true, NonRecursiveFileCustomData::class.java)
val fileSet = workspaceFileIndex.findFileSetWithCustomData(file, true, true, true, true, true, true, true, NonRecursiveFileCustomData::class.java)
assertNull(fileSet)
val nonRecursiveDirFileSet = workspaceFileIndex.findFileSetWithCustomData(nonRecursiveDir, true, true, true, true, true, true, NonRecursiveFileCustomData::class.java)
val nonRecursiveDirFileSet = workspaceFileIndex.findFileSetWithCustomData(nonRecursiveDir, true, true, true, true, true, true, true, NonRecursiveFileCustomData::class.java)
assertNotNull(nonRecursiveDirFileSet)
}
}
@@ -53,10 +53,10 @@ c:com.intellij.openapi.roots.impl.ProjectFileIndexFacade
- s:values():com.intellij.workspaceModel.core.fileIndex.EntityStorageKind[]
*:com.intellij.workspaceModel.core.fileIndex.WorkspaceFileIndex
- *sf:Companion:com.intellij.workspaceModel.core.fileIndex.WorkspaceFileIndex$Companion
- a:findFileSet(com.intellij.openapi.vfs.VirtualFile,Z,Z,Z,Z,Z,Z):com.intellij.workspaceModel.core.fileIndex.WorkspaceFileSet
- a:findFileSetWithCustomData(com.intellij.openapi.vfs.VirtualFile,Z,Z,Z,Z,Z,Z,java.lang.Class):com.intellij.workspaceModel.core.fileIndex.WorkspaceFileSetWithCustomData
- *a:findFileSets(com.intellij.openapi.vfs.VirtualFile,Z,Z,Z,Z,Z,Z):java.util.List
- *a:findFileSetsWithCustomData(com.intellij.openapi.vfs.VirtualFile,Z,Z,Z,Z,Z,Z,java.lang.Class):java.util.List
- a:findFileSet(com.intellij.openapi.vfs.VirtualFile,Z,Z,Z,Z,Z,Z,Z):com.intellij.workspaceModel.core.fileIndex.WorkspaceFileSet
- a:findFileSetWithCustomData(com.intellij.openapi.vfs.VirtualFile,Z,Z,Z,Z,Z,Z,Z,java.lang.Class):com.intellij.workspaceModel.core.fileIndex.WorkspaceFileSetWithCustomData
- *a:findFileSets(com.intellij.openapi.vfs.VirtualFile,Z,Z,Z,Z,Z,Z,Z):java.util.List
- *a:findFileSetsWithCustomData(com.intellij.openapi.vfs.VirtualFile,Z,Z,Z,Z,Z,Z,Z,java.lang.Class):java.util.List
- a:getContentFileSetRoot(com.intellij.openapi.vfs.VirtualFile,Z):com.intellij.openapi.vfs.VirtualFile
- s:getInstance(com.intellij.openapi.project.Project):com.intellij.workspaceModel.core.fileIndex.WorkspaceFileIndex
- a:isInContent(com.intellij.openapi.vfs.VirtualFile):Z
@@ -76,6 +76,7 @@ c:com.intellij.openapi.roots.impl.ProjectFileIndexFacade
- sf:CONTENT_NON_INDEXABLE:com.intellij.workspaceModel.core.fileIndex.WorkspaceFileKind
- sf:CUSTOM:com.intellij.workspaceModel.core.fileIndex.WorkspaceFileKind
- sf:EXTERNAL:com.intellij.workspaceModel.core.fileIndex.WorkspaceFileKind
- sf:EXTERNAL_NON_INDEXABLE:com.intellij.workspaceModel.core.fileIndex.WorkspaceFileKind
- sf:EXTERNAL_SOURCE:com.intellij.workspaceModel.core.fileIndex.WorkspaceFileKind
- sf:TEST_CONTENT:com.intellij.workspaceModel.core.fileIndex.WorkspaceFileKind
- s:getEntries():kotlin.enums.EnumEntries
@@ -37,6 +37,7 @@ internal class ProjectModelEntityContextProvider : CodeInsightContextProvider {
includeContentNonIndexableSets = true,
includeExternalSets = true,
includeExternalSourceSets = true,
includeExternalNonIndexableSets = true,
includeCustomKindSets = true
)
if (fileSets.isEmpty()) return emptyList()
@@ -123,7 +123,7 @@ public final class DirectoryIndexImpl extends DirectoryIndex implements Disposab
public @NotNull List<OrderEntry> getOrderEntries(@NotNull VirtualFile fileOrDir) {
checkAvailability();
if (myProject.isDefault()) return Collections.emptyList();
WorkspaceFileInternalInfo fileInfo = myWorkspaceFileIndex.getFileInfo(fileOrDir, true, true, true, true, true, false);
WorkspaceFileInternalInfo fileInfo = myWorkspaceFileIndex.getFileInfo(fileOrDir, true, true, true, true, true, true, false);
WorkspaceFileSetWithCustomData<?> fileSet = fileInfo.findFileSet(data -> true);
if (fileSet == null) return Collections.emptyList();
return getRootIndex().getOrderEntries(fileSet.getRoot());
@@ -81,7 +81,7 @@ public class ModuleFileIndexImpl extends FileIndexBase implements ModuleFileInde
if (parent == null) {
return false;
}
WorkspaceFileInternalInfo fileInfo = myWorkspaceFileIndex.getFileInfo(parent, false, true, true, false, false, false);
WorkspaceFileInternalInfo fileInfo = myWorkspaceFileIndex.getFileInfo(parent, false, true, true, false, false, false, false);
return fileInfo.findFileSet(this::hasRecursiveRootFromModuleContent) != null;
}
@@ -95,7 +95,7 @@ public class ModuleFileIndexImpl extends FileIndexBase implements ModuleFileInde
@Override
public boolean isInContent(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSetWithCustomData<ModuleRelatedRootData> fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, ModuleRelatedRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, false, ModuleRelatedRootData.class);
return isFromThisModule(fileSet);
}
@@ -105,7 +105,7 @@ public class ModuleFileIndexImpl extends FileIndexBase implements ModuleFileInde
@Override
public boolean isInSourceContent(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet = myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, ModuleSourceRootData.class);
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet = myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, false, ModuleSourceRootData.class);
return fileSet != null && isFromThisModule(fileSet);
}
@@ -121,13 +121,13 @@ public class ModuleFileIndexImpl extends FileIndexBase implements ModuleFileInde
@Override
public boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet = myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, ModuleSourceRootData.class);
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet = myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, false, ModuleSourceRootData.class);
return fileSet != null && isFromThisModule(fileSet) && fileSet.getKind() == WorkspaceFileKind.TEST_CONTENT;
}
@Override
public boolean isUnderSourceRootOfType(@NotNull VirtualFile fileOrDir, @NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet = myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, ModuleSourceRootData.class);
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet = myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, false, ModuleSourceRootData.class);
return isFromThisModule(fileSet) && ProjectFileIndexImpl.isSourceRootOfType(fileSet, rootTypes);
}
@@ -126,11 +126,11 @@ public class ProjectFileIndexFacade extends FileIndexFacade {
@Override
public boolean isInProjectScope(@NotNull VirtualFile file) {
// optimization: equivalent to the super method but has fewer getInfoForFile() calls
WorkspaceFileInternalInfo fileInfo = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, false, false);
WorkspaceFileInternalInfo fileInfo = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, false, true, false);
if (fileInfo instanceof WorkspaceFileInternalInfo.NonWorkspace) {
return false;
}
if (fileInfo.findFileSet(it -> it.getKind() == WorkspaceFileKind.EXTERNAL) != null && !myFileIndex.isInSourceContent(file)) {
if (fileInfo.findFileSet(it -> it.getKind() == WorkspaceFileKind.EXTERNAL || it.getKind() == WorkspaceFileKind.EXTERNAL_NON_INDEXABLE) != null && !myFileIndex.isInSourceContent(file)) {
return false;
}
return true;
@@ -78,34 +78,34 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public boolean isExcluded(@NotNull VirtualFile file) {
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, true, true);
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, true, true, true);
return info == WorkspaceFileInternalInfo.NonWorkspace.IGNORED || info == WorkspaceFileInternalInfo.NonWorkspace.EXCLUDED;
}
@Override
public @NotNull Collection<@NotNull LibraryEntity> findContainingLibraries(@NotNull VirtualFile fileOrDir) {
return myWorkspaceFileIndex.findContainingEntities(fileOrDir, LibraryEntity.class, true, false, false, true, true, false);
return myWorkspaceFileIndex.findContainingEntities(fileOrDir, LibraryEntity.class, true, false, false, true, true, true, false);
}
@Override
public @NotNull @Unmodifiable Collection<@NotNull SdkEntity> findContainingSdks(@NotNull VirtualFile fileOrDir) {
return myWorkspaceFileIndex.findContainingEntities(fileOrDir, SdkEntity.class, true, false, false, true, true, false);
return myWorkspaceFileIndex.findContainingEntities(fileOrDir, SdkEntity.class, true, false, false, true, true, true, false);
}
@Override
public boolean isUnderIgnored(@NotNull VirtualFile file) {
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, true, true);
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, true, true, true);
return info == WorkspaceFileInternalInfo.NonWorkspace.IGNORED;
}
@Override
public boolean isInProject(@NotNull VirtualFile file) {
return myWorkspaceFileIndex.findFileSet(file, true, true, true, true, true, false) != null;
return myWorkspaceFileIndex.findFileSet(file, true, true, true, true, true, true, false) != null;
}
@Override
public boolean isInProjectOrExcluded(@NotNull VirtualFile file) {
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, true, false);
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, true, true, false);
return info == WorkspaceFileInternalInfo.NonWorkspace.EXCLUDED || !(info instanceof WorkspaceFileInternalInfo.NonWorkspace);
}
@@ -117,7 +117,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public @Nullable Module getModuleForFile(@NotNull VirtualFile file, boolean honorExclusion) {
WorkspaceFileSetWithCustomData<ModuleRelatedRootData> fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(file, honorExclusion, true, true, false, false, false, ModuleRelatedRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(file, honorExclusion, true, true, false, false, false, false, ModuleRelatedRootData.class);
if (fileSet == null) return null;
return fileSet.getData().getModule();
}
@@ -125,7 +125,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public @NotNull Set<Module> getModulesForFile(@NotNull VirtualFile file, boolean honorExclusion) {
List<WorkspaceFileSetWithCustomData<ModuleRelatedRootData>> fileSet = myWorkspaceFileIndex.findFileSetsWithCustomData(
file, honorExclusion, true, true, false, false, false, ModuleRelatedRootData.class
file, honorExclusion, true, true, false, false, false, false, ModuleRelatedRootData.class
);
return ContainerUtil.map2LinkedSet(fileSet, s -> s.getData().getModule());
}
@@ -137,7 +137,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public VirtualFile getClassRootForFile(@NotNull VirtualFile file) {
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(file, true, false, false, true, false, false);
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(file, true, false, false, true, false, false, false);
if (fileSet == null) return null;
return fileSet.getRoot();
}
@@ -145,7 +145,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public @Nullable JpsModuleSourceRootType<?> getContainingSourceRootType(@NotNull VirtualFile file) {
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(file, true, true, true, false, false, false, ModuleSourceRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(file, true, true, true, false, false, false, false, ModuleSourceRootData.class);
if (fileSet == null) return null;
return SourceRootTypeRegistry.getInstance().findTypeById(fileSet.getData().getRootTypeId());
@@ -154,14 +154,14 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public boolean isInGeneratedSources(@NotNull VirtualFile file) {
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(file, true, true, true, false, false, false, ModuleSourceRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(file, true, true, true, false, false, false, false, ModuleSourceRootData.class);
return fileSet != null && fileSet.getData().getForGeneratedSources();
}
@Override
public VirtualFile getSourceRootForFile(@NotNull VirtualFile file) {
WorkspaceFileSet fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(file, true, true, true, false, true, false, ModuleOrLibrarySourceRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(file, true, true, true, false, true, false, false, ModuleOrLibrarySourceRootData.class);
if (fileSet == null) return null;
return fileSet.getRoot();
}
@@ -174,12 +174,12 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public VirtualFile getContentRootForFile(@NotNull VirtualFile file, final boolean honorExclusion) {
WorkspaceFileSetWithCustomData<ModuleContentOrSourceRootData> fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(file, honorExclusion, true, true, false, false, false,
myWorkspaceFileIndex.findFileSetWithCustomData(file, honorExclusion, true, true, false, false, false, false,
ModuleContentOrSourceRootData.class);
if (fileSet == null) {
if (!honorExclusion) {
WorkspaceFileSetWithCustomData<UnloadedModuleContentRootData> unloadedFileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(file, false, true, true, false, false, false,
myWorkspaceFileIndex.findFileSetWithCustomData(file, false, true, true, false, false, false, false,
UnloadedModuleContentRootData.class);
if (unloadedFileSet != null) return unloadedFileSet.getRoot();
}
@@ -201,33 +201,33 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public boolean isLibraryClassFile(@NotNull VirtualFile file) {
if (file.isDirectory()) return false;
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(file, true, false, false, true, false, false);
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(file, true, false, false, true, false, false, false);
return fileSet != null;
}
@Override
public boolean isInSource(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSet fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, true, false, ModuleOrLibrarySourceRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, true, false, false, ModuleOrLibrarySourceRootData.class);
return fileSet != null;
}
@Override
public boolean isInLibraryClasses(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(fileOrDir, true, false, false, true, false, false);
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(fileOrDir, true, false, false, true, false, false, false);
return fileSet != null;
}
@Override
public boolean isInLibrarySource(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(fileOrDir, true, false, false, false, true, false);
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(fileOrDir, true, false, false, false, true, false, false);
return fileSet != null;
}
// a slightly faster implementation than the default one
@Override
public boolean isInLibrary(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(fileOrDir, true, false, false, true, true, false);
WorkspaceFileSet fileSet = myWorkspaceFileIndex.findFileSet(fileOrDir, true, false, false, true, true, true, false);
return fileSet != null;
}
@@ -237,7 +237,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
}
public @Nullable VirtualFile getModuleSourceOrLibraryClassesRoot(@NotNull VirtualFile file) {
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, false, false);
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, false, false, false);
WorkspaceFileSetWithCustomData<?> fileSet = info.findFileSet(it -> {
WorkspaceFileKind kind = it.getKind();
return kind.isContent() && it.getData() instanceof ModuleOrLibrarySourceRootData || kind == WorkspaceFileKind.EXTERNAL;
@@ -246,7 +246,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
}
public @NotNull Collection<RootDescriptor> getModuleSourceOrLibraryClassesRoots(@NotNull VirtualFile file) {
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, false, false);
WorkspaceFileInternalInfo info = myWorkspaceFileIndex.getFileInfo(file, true, true, true, true, false, false, false);
List<WorkspaceFileSetWithCustomData<?>> fileSets = info.findFileSets(it -> {
WorkspaceFileKind kind = it.getKind();
return kind.isContent() && it.getData() instanceof ModuleOrLibrarySourceRootData || kind == WorkspaceFileKind.EXTERNAL;
@@ -273,21 +273,21 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public boolean isInSourceContent(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSet fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, ModuleSourceRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, false, ModuleSourceRootData.class);
return fileSet != null;
}
@Override
public boolean isInTestSourceContent(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSet fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, ModuleSourceRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, false, ModuleSourceRootData.class);
return fileSet != null && fileSet.getKind() == WorkspaceFileKind.TEST_CONTENT;
}
@Override
public boolean isUnderSourceRootOfType(@NotNull VirtualFile fileOrDir, @NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
WorkspaceFileSetWithCustomData<ModuleSourceRootData> fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, ModuleSourceRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, true, true, true, false, false, false, false, ModuleSourceRootData.class);
return isSourceRootOfType(fileSet, rootTypes);
}
@@ -300,7 +300,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
@Override
public @Nullable String getUnloadedModuleNameForFile(@NotNull VirtualFile fileOrDir) {
WorkspaceFileSetWithCustomData<UnloadedModuleContentRootData> fileSet =
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, false, true, true, false, false, false, UnloadedModuleContentRootData.class);
myWorkspaceFileIndex.findFileSetWithCustomData(fileOrDir, false, true, true, false, false, false, false, UnloadedModuleContentRootData.class);
return fileSet != null ? fileSet.getData().getModuleName() : null;
}
@@ -40,7 +40,8 @@ interface WorkspaceFileIndex {
fun isInContent(file: VirtualFile): Boolean
/**
* Returns `true` if [file] is included to the workspace and doesn't have [WorkspaceFileKind.CONTENT_NON_INDEXABLE] kind.
* Returns `true` if [file] is included to the workspace and doesn't have [WorkspaceFileKind.CONTENT_NON_INDEXABLE] or
* [WorkspaceFileKind.EXTERNAL_NON_INDEXABLE] kind.
*/
@RequiresReadLock
fun isIndexable(file: VirtualFile): Boolean
@@ -75,6 +76,7 @@ interface WorkspaceFileIndex {
* @param includeContentSets if `true` file sets of [content][WorkspaceFileKind.isContent] kind will be processed
* @param includeExternalSets if `true` file sets of [WorkspaceFileKind.EXTERNAL] kind will be processed
* @param includeExternalSourceSets if `true` file sets of [WorkspaceFileKind.EXTERNAL_SOURCE] kind will be processed
* @param includeExternalNonIndexableSets if `true` file sets of [WorkspaceFileKind.EXTERNAL_NON_INDEXABLE] kind will be processed
* @param includeCustomKindSets if `true` file sets of [WorkspaceFileKind.CUSTOM] kind will be processed
*/
fun findFileSet(
@@ -84,6 +86,7 @@ interface WorkspaceFileIndex {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean
): WorkspaceFileSet?
@@ -97,6 +100,7 @@ interface WorkspaceFileIndex {
* @param includeContentSets if `true` file sets of [content][WorkspaceFileKind.isContent] kind will be processed
* @param includeExternalSets if `true` file sets of [WorkspaceFileKind.EXTERNAL] kind will be processed
* @param includeExternalSourceSets if `true` file sets of [WorkspaceFileKind.EXTERNAL_SOURCE] kind will be processed
* @param includeExternalNonIndexableSets if `true` file sets of [WorkspaceFileKind.EXTERNAL_NON_INDEXABLE] kind will be processed
* @param includeCustomKindSets if `true` file sets of [WorkspaceFileKind.CUSTOM] kind will be processed
*/
@ApiStatus.Experimental
@@ -107,6 +111,7 @@ interface WorkspaceFileIndex {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean
): List<WorkspaceFileSet>
@@ -121,6 +126,7 @@ interface WorkspaceFileIndex {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean,
customDataClass: Class<out D>,
): WorkspaceFileSetWithCustomData<D>?
@@ -137,6 +143,7 @@ interface WorkspaceFileIndex {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean,
customDataClass: Class<out D>,
): List<WorkspaceFileSetWithCustomData<D>>
@@ -160,6 +160,13 @@ enum class WorkspaceFileKind {
*/
EXTERNAL_SOURCE,
/**
* Describes external files which may be referenced by [CONTENT] files, but aren't supposed to be edited in the IDE,
* and should NOT be indexed. This is useful for library files that should be visible in the workspace but don't
* need to be indexed (e.g., header search paths in C++ projects that are too large to index).
*/
EXTERNAL_NON_INDEXABLE,
/**
* Describes files which may be referenced by [CONTENT], [EXTERNAL], or [EXTERNAL_SOURCE] files,
* and aren't supposed to be edited in the IDE.
@@ -175,7 +182,7 @@ enum class WorkspaceFileKind {
get() = this == CONTENT || this == TEST_CONTENT || this == CONTENT_NON_INDEXABLE
val isIndexable: Boolean
get() = (this != CONTENT_NON_INDEXABLE)
get() = (this != CONTENT_NON_INDEXABLE && this != EXTERNAL_NON_INDEXABLE)
}
/**
@@ -26,6 +26,7 @@ class EmptyWorkspaceFileIndexData private constructor(private val debugName: Str
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean
): WorkspaceFileInternalInfo {
return WorkspaceFileInternalInfo.NonWorkspace.NOT_UNDER_ROOTS
@@ -21,6 +21,7 @@ interface WorkspaceFileIndexData {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean): WorkspaceFileInternalInfo
@RequiresReadLock
@@ -167,6 +167,7 @@ internal class WorkspaceFileIndexDataImpl(
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean
): WorkspaceFileInternalInfo = WorkspaceFileIndexDataMetrics.getFileInfoTimeNanosec.addMeasuredTime {
if (!file.isValid) return@addMeasuredTime WorkspaceFileInternalInfo.NonWorkspace.INVALID
@@ -180,6 +181,7 @@ internal class WorkspaceFileIndexDataImpl(
(if (includeContentNonIndexableSets) WorkspaceFileKindMask.CONTENT_NON_INDEXABLE else 0) or
(if (includeExternalSets) WorkspaceFileKindMask.EXTERNAL_BINARY else 0) or
(if (includeExternalSourceSets) WorkspaceFileKindMask.EXTERNAL_SOURCE else 0) or
(if (includeExternalNonIndexableSets) WorkspaceFileKindMask.EXTERNAL_NON_INDEXABLE else 0) or
(if (includeCustomKindSets) WorkspaceFileKindMask.CUSTOM else 0)
var acceptedKindsMask = originalAcceptedKindMask
var current: VirtualFile? = file
@@ -582,7 +584,7 @@ internal class WorkspaceFileIndexDataImpl(
}
override fun getPackageName(dirOrFile: VirtualFile): String? = WorkspaceFileIndexDataMetrics.getPackageNameTimeNanosec.addMeasuredTime {
val fileSet = when (val info = getFileInfo(dirOrFile, true, true, true, true, true, true)) {
val fileSet = when (val info = getFileInfo(dirOrFile, true, true, true, true, true, true, true)) {
is WorkspaceFileSetWithCustomData<*> -> info.takeIf { it.data is JvmPackageRootDataInternal }
is MultipleWorkspaceFileSets -> info.find(JvmPackageRootDataInternal::class.java)
else -> null
@@ -606,7 +608,7 @@ internal class WorkspaceFileIndexDataImpl(
val query = CollectionQuery(packageDirectoryCache.getDirectoriesByPackageName(packageName))
return@addMeasuredTime if (includeLibrarySources) query
else query.filtering {
getFileInfo(it, true, true, true, true, false, true) !is WorkspaceFileInternalInfo.NonWorkspace
getFileInfo(it, true, true, true, true, false, true, true) !is WorkspaceFileInternalInfo.NonWorkspace
}
}
@@ -759,6 +761,7 @@ internal fun WorkspaceFileKind.toMask(): Int {
WorkspaceFileKind.CONTENT, WorkspaceFileKind.TEST_CONTENT -> WorkspaceFileKindMask.CONTENT
WorkspaceFileKind.EXTERNAL -> WorkspaceFileKindMask.EXTERNAL_BINARY
WorkspaceFileKind.EXTERNAL_SOURCE -> WorkspaceFileKindMask.EXTERNAL_SOURCE
WorkspaceFileKind.EXTERNAL_NON_INDEXABLE -> WorkspaceFileKindMask.EXTERNAL_NON_INDEXABLE
WorkspaceFileKind.CUSTOM -> WorkspaceFileKindMask.CUSTOM
WorkspaceFileKind.CONTENT_NON_INDEXABLE -> WorkspaceFileKindMask.CONTENT_NON_INDEXABLE
}
@@ -864,7 +867,7 @@ private class StoreFileSetsRegistrarImpl(
}
else {
val mask = when (excludedFrom) {
WorkspaceFileKind.EXTERNAL -> WorkspaceFileKindMask.EXTERNAL
WorkspaceFileKind.EXTERNAL -> WorkspaceFileKindMask.EXTERNAL or WorkspaceFileKindMask.EXTERNAL_NON_INDEXABLE
WorkspaceFileKind.CONTENT -> WorkspaceFileKindMask.CONTENT or WorkspaceFileKindMask.CONTENT_NON_INDEXABLE
else -> excludedFrom.toMask()
}
@@ -35,6 +35,7 @@ interface WorkspaceFileIndexEx : WorkspaceFileIndex {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean): WorkspaceFileInternalInfo
/**
@@ -52,6 +53,7 @@ interface WorkspaceFileIndexEx : WorkspaceFileIndex {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean): Collection<E>
/**
@@ -66,6 +68,7 @@ interface WorkspaceFileIndexEx : WorkspaceFileIndex {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean,
): Collection<WorkspaceEntity>
@@ -90,6 +90,7 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets = true,
includeExternalSets = true,
includeExternalSourceSets = true,
includeExternalNonIndexableSets = true,
includeCustomKindSets = true) != null
}
@@ -100,15 +101,16 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets = true,
includeExternalSets = false,
includeExternalSourceSets = false,
includeExternalNonIndexableSets = false,
includeCustomKindSets = false) != null
}
override fun isIndexable(file: VirtualFile): Boolean {
return findFileSet(file, true, true, includeContentNonIndexableSets = false, true, true, true) != null
return findFileSet(file, true, true, includeContentNonIndexableSets = false, true, true, includeExternalNonIndexableSets = false, true) != null
}
override fun getContentFileSetRoot(file: VirtualFile, honorExclusion: Boolean): VirtualFile? {
return findFileSet(file, honorExclusion, true, true, false, false, false)?.root
return findFileSet(file, honorExclusion, true, true, false, false, false, false)?.root
}
override fun isUrlInContent(url: String): ThreeState {
@@ -163,6 +165,7 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets = true,
includeExternalSets = false,
includeExternalSourceSets = false,
includeExternalNonIndexableSets = false,
includeCustomKindSets = false)
})
if (file.isDirectory && fileInfo is NonWorkspace) {
@@ -229,6 +232,7 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets = true,
includeExternalSets = false,
includeExternalSourceSets = false,
includeExternalNonIndexableSets = false,
includeCustomKindSets = false) != null
}
return@processChildrenRecursively if (isChildInContent) {
@@ -256,9 +260,10 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean,
): WorkspaceFileSet? {
return when (val info = getFileInfo(file, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeCustomKindSets)) {
return when (val info = getFileInfo(file, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeExternalNonIndexableSets, includeCustomKindSets)) {
is WorkspaceFileSetImpl -> info
is MultipleWorkspaceFileSets -> info.find(null)
else -> null
@@ -272,6 +277,7 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean,
): List<WorkspaceFileSet> {
val info = getFileInfo(
@@ -281,6 +287,7 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets = includeContentNonIndexableSets,
includeExternalSets = includeExternalSets,
includeExternalSourceSets = includeExternalSourceSets,
includeExternalNonIndexableSets = includeExternalNonIndexableSets,
includeCustomKindSets = includeCustomKindSets
)
return when (info) {
@@ -321,11 +328,12 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean,
customDataClass: Class<out D>,
): WorkspaceFileSetWithCustomData<D>? {
val result = when (val info = getFileInfo(file, honorExclusion, includeContentSets,
includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeCustomKindSets)) {
includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeExternalNonIndexableSets, includeCustomKindSets)) {
is WorkspaceFileSetWithCustomData<*> -> info.takeIf { customDataClass.isInstance(it.data) }
is MultipleWorkspaceFileSets -> info.find(customDataClass)
else -> null
@@ -341,10 +349,11 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean,
customDataClass: Class<out D>,
): List<WorkspaceFileSetWithCustomData<D>> {
val info = getFileInfo(file, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeCustomKindSets)
val info = getFileInfo(file, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeExternalNonIndexableSets, includeCustomKindSets)
val result = when (info) {
is WorkspaceFileSetWithCustomData<*> -> listOfNotNull(info.takeIf { customDataClass.isInstance(it.data) })
is MultipleWorkspaceFileSets -> info.fileSets.filter { customDataClass.isInstance(it.data) }
@@ -361,20 +370,21 @@ class WorkspaceFileIndexImpl : WorkspaceFileIndexEx, Disposable.Default {
includeContentNonIndexableSets: Boolean,
includeExternalSets: Boolean,
includeExternalSourceSets: Boolean,
includeExternalNonIndexableSets: Boolean,
includeCustomKindSets: Boolean,
): WorkspaceFileInternalInfo {
val unwrappedFile = BackedVirtualFile.getOriginFileIfBacked((file as? VirtualFileWindow)?.delegate ?: file)
return getMainIndexData().getFileInfo(unwrappedFile, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeCustomKindSets)
return getMainIndexData().getFileInfo(unwrappedFile, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeExternalNonIndexableSets, includeCustomKindSets)
}
override fun <E : WorkspaceEntity> findContainingEntities(file: VirtualFile, entityClass: Class<E>, honorExclusion: Boolean, includeContentSets: Boolean, includeContentNonIndexableSets: Boolean, includeExternalSets: Boolean, includeExternalSourceSets: Boolean, includeCustomKindSets: Boolean): Collection<E> {
val allEntities = findContainingEntities(file, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeCustomKindSets)
override fun <E : WorkspaceEntity> findContainingEntities(file: VirtualFile, entityClass: Class<E>, honorExclusion: Boolean, includeContentSets: Boolean, includeContentNonIndexableSets: Boolean, includeExternalSets: Boolean, includeExternalSourceSets: Boolean, includeExternalNonIndexableSets: Boolean, includeCustomKindSets: Boolean): Collection<E> {
val allEntities = findContainingEntities(file, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeExternalNonIndexableSets, includeCustomKindSets)
@Suppress("UNCHECKED_CAST")
return allEntities.filter { entity -> entity.getEntityInterface() == entityClass } as Collection<E>
}
override fun findContainingEntities(file: VirtualFile, honorExclusion: Boolean, includeContentSets: Boolean, includeContentNonIndexableSets: Boolean, includeExternalSets: Boolean, includeExternalSourceSets: Boolean, includeCustomKindSets: Boolean): Collection<WorkspaceEntity> {
return when (val fileInfo = getFileInfo(file, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeCustomKindSets)) {
override fun findContainingEntities(file: VirtualFile, honorExclusion: Boolean, includeContentSets: Boolean, includeContentNonIndexableSets: Boolean, includeExternalSets: Boolean, includeExternalSourceSets: Boolean, includeExternalNonIndexableSets: Boolean, includeCustomKindSets: Boolean): Collection<WorkspaceEntity> {
return when (val fileInfo = getFileInfo(file, honorExclusion, includeContentSets, includeContentNonIndexableSets, includeExternalSets, includeExternalSourceSets, includeExternalNonIndexableSets, includeCustomKindSets)) {
is WorkspaceFileSetImpl -> listOfNotNull(resolveEntity(fileInfo))
is MultipleWorkspaceFileSets -> fileInfo.fileSets.mapNotNull { fileSet ->
(fileSet as? StoredFileSet?)?.let { resolveEntity(it) }
@@ -10,7 +10,7 @@ import com.intellij.openapi.vfs.VirtualFile
internal fun reportInfiniteRecursion(file: VirtualFile, fileIndex: WorkspaceFileIndexImpl) {
val parentsData = runReadAction {
generateSequence(file, VirtualFile::getParent).joinToString("\n") { file ->
val fileInfo = fileIndex.getFileInfo(file, true, true, true, false, false, false)
val fileInfo = fileIndex.getFileInfo(file, true, true, true, false, false, false, false)
val symlinkData = if (file.`is`(VFileProperty.SYMLINK)) {
", link to ${file.canonicalFile}, recursive=${file.isRecursiveOrCircularSymlink}"
}
@@ -298,7 +298,8 @@ internal object WorkspaceFileKindMask {
const val EXTERNAL = EXTERNAL_SOURCE or EXTERNAL_BINARY
const val CUSTOM = 8
const val CONTENT_NON_INDEXABLE = 16
const val ALL = CONTENT or EXTERNAL or CUSTOM or CONTENT_NON_INDEXABLE
const val EXTERNAL_NON_INDEXABLE = 32
const val ALL = CONTENT or EXTERNAL or CUSTOM or CONTENT_NON_INDEXABLE or EXTERNAL_NON_INDEXABLE
}
internal sealed interface ExcludedFileSet : StoredFileSet {
@@ -70,6 +70,7 @@ internal object CandidateCollector {
includeContentNonIndexableSets = true,
includeExternalSets = true,
includeExternalSourceSets = true,
includeExternalNonIndexableSets = true,
includeCustomKindSets = true
).fileSets