VirtualFileSet () { VirtualFileSet fileSet = VfsUtilCore.createCompactVirtualFileSet(); switch (myType) { case FILE -> { fileSet.add(((PsiFileSystemItem)myElement).getVirtualFile()); fileSet.freeze(); } case DIRECTORY, PROJECT, MODULES, MODULE, CUSTOM -> { long timeStamp = System.currentTimeMillis(); accept(createFileSearcher(fileSet)); fileSet.freeze(); LOG.info("Scanning scope took " + (System.currentTimeMillis() - timeStamp) + " ms"); } case VIRTUAL_FILES -> { ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex(); for (VirtualFile vFile : myVFiles) { VfsUtilCore.visitChildrenRecursively(vFile, new VirtualFileVisitor<Void>() { @Override public @NotNull Result visitFileEx(@NotNull VirtualFile file) { boolean ignored = ReadAction.compute(() -> fileIndex.isExcluded(file)); if (!ignored && !file.isDirectory()) { fileSet.add(file); } return ignored ? SKIP_CHILDREN : CONTINUE; } }); } fileSet.freeze(); } default -> throw new IllegalStateException("Invalid type: " + myType + "; can't create file set off it"); } return fileSet; }