Set<PsiClass> (Module module, RegistrationTypeFinder finder) { final DomFileElement<IdeaPlugin> pluginXml = getPluginXmlFile(module); if (pluginXml == null) { return null; } // "main" plugin.xml XmlFile pluginXmlFile = pluginXml.getFile(); if (!finder.processScope(GlobalSearchScope.fileScope(pluginXmlFile))) { return finder.getTypes(); } Set<PsiFile> processedFiles = new HashSet<>(); processedFiles.add(pluginXmlFile); // <depends> plugin.xml files for (Dependency dependency : pluginXml.getRootElement().getDepends()) { XmlFile depPluginXml = dependency.getResolvedConfigFile(); if (depPluginXml != null) { final DomFileElement<IdeaPlugin> dependentIdeaPlugin = DescriptorUtil.getIdeaPluginFileElement(depPluginXml); if (dependentIdeaPlugin != null) { if (!finder.processScope(GlobalSearchScope.fileScope(dependentIdeaPlugin.getFile()))) { return finder.getTypes(); } } processedFiles.add(depPluginXml); } } Project project = module.getProject(); PsiManager psiManager = PsiManager.getInstance(project); FileIncludeManager includeManager = FileIncludeManager.getManager(project); Set<PsiFile> processedIncludedFiles = new HashSet<>(); for (PsiFile file : processedFiles) { // main plugin.xml + dependents VirtualFile[] includes = includeManager.getIncludedFiles(file.getVirtualFile(), true, true); for (VirtualFile includedFile : includes) { PsiFile includedPsiFile = psiManager.findFile(includedFile); if (includedPsiFile == null) { continue; } if (processedFiles.contains(includedPsiFile) || !processedIncludedFiles.add(includedPsiFile)) { continue; } if (!finder.processScope(GlobalSearchScope.fileScope(includedPsiFile))) { return finder.getTypes(); } } } return finder.getTypes(); }