IDEA-168449 Change search scope for plugin descriptors
authorYaroslav Pankratyev <yaroslav.pankratyev@jetbrains.com>
Thu, 10 Aug 2017 10:47:02 +0000 (17:47 +0700)
committerYaroslav Pankratyev <yaroslav.pankratyev@jetbrains.com>
Thu, 10 Aug 2017 10:47:02 +0000 (17:47 +0700)
platform/core-api/src/com/intellij/psi/search/GlobalSearchScope.java
plugins/devkit/src/util/PluginRelatedLocatorsUtils.java

index a43923aaeeb6760df33a437a52affbb3edefcd2f..7c4dcbaa3c86c1c6cff21c4d22f6f67393c228de 100644 (file)
@@ -353,6 +353,9 @@ public abstract class GlobalSearchScope extends SearchScope implements ProjectAw
     return filesWithLibrariesScope(project, files, false);
   }
 
+  /**
+   * @since 2017.3
+   */
   @NotNull
   public static GlobalSearchScope filesWithLibrariesScope(@NotNull Project project, @NotNull Collection<VirtualFile> files,
                                                           boolean searchOutsideRootModel) {
index 5960635045e4c250c03e1437a9031f87e3762df9..8b4a4695043c65f6a793f8aecfbae5ec6d09b315 100644 (file)
 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.psi.search.GlobalSearchScopesCore;
 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) {
+    GlobalSearchScope scope = GlobalSearchScopesCore.projectProductionScope(project)
+      .uniteWith(LibraryScopeCache.getInstance(project).getLibrariesOnlyScope());
+
     Collection<VirtualFile> candidates = DomService.getInstance()
-      .getDomFileCandidates(IdeaPlugin.class, project, GlobalSearchScope.allScope(project));
+      .getDomFileCandidates(IdeaPlugin.class, project, scope);
     return GlobalSearchScope.filesWithLibrariesScope(project, candidates, true);
   }
 }