IDEA-168449 Change search scope for plugin descriptors
[idea/community.git] / plugins / devkit / src / util / PluginRelatedLocatorsUtils.java
index 5960635045e4c250c03e1437a9031f87e3762df9..8b4a4695043c65f6a793f8aecfbae5ec6d09b315 100644 (file)
 package org.jetbrains.idea.devkit.util;
 
 import com.intellij.openapi.project.Project;
 package org.jetbrains.idea.devkit.util;
 
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.impl.LibraryScopeCache;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.search.GlobalSearchScopesCore;
 import com.intellij.util.xml.DomService;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.idea.devkit.dom.IdeaPlugin;
 import com.intellij.util.xml.DomService;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.idea.devkit.dom.IdeaPlugin;
@@ -30,8 +32,11 @@ class PluginRelatedLocatorsUtils {
 
   @NotNull
   static GlobalSearchScope getCandidatesScope(@NotNull Project project) {
 
   @NotNull
   static GlobalSearchScope getCandidatesScope(@NotNull Project project) {
+    GlobalSearchScope scope = GlobalSearchScopesCore.projectProductionScope(project)
+      .uniteWith(LibraryScopeCache.getInstance(project).getLibrariesOnlyScope());
+
     Collection<VirtualFile> candidates = DomService.getInstance()
     Collection<VirtualFile> candidates = DomService.getInstance()
-      .getDomFileCandidates(IdeaPlugin.class, project, GlobalSearchScope.allScope(project));
+      .getDomFileCandidates(IdeaPlugin.class, project, scope);
     return GlobalSearchScope.filesWithLibrariesScope(project, candidates, true);
   }
 }
     return GlobalSearchScope.filesWithLibrariesScope(project, candidates, true);
   }
 }