scopes: keep all scopes if showEmptyScopes=true (in this case, files in a scope at...
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Fri, 15 Jul 2016 14:27:13 +0000 (17:27 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Fri, 15 Jul 2016 14:27:45 +0000 (17:27 +0300)
previously, "Open Files" scope prevented adding "Current File" if both scopes are empty

platform/lang-impl/src/com/intellij/psi/search/PredefinedSearchScopeProviderImpl.java

index e8fdb614917418669c03b4fae8955c40d5cfce5a..9d98ba26c2937170b5f603e8932d40341058efe6 100644 (file)
@@ -29,7 +29,6 @@ import com.intellij.openapi.fileEditor.FileEditorManager;
 import com.intellij.openapi.module.*;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Computable;
-import com.intellij.openapi.util.Condition;
 import com.intellij.openapi.util.Pair;
 import com.intellij.openapi.util.TextRange;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -69,7 +68,7 @@ public class PredefinedSearchScopeProviderImpl extends PredefinedSearchScopeProv
                                                boolean currentSelection,
                                                boolean usageView,
                                                boolean showEmptyScopes) {
-    Collection<SearchScope> result = ContainerUtil.newLinkedHashSet();
+    Collection<SearchScope> result = showEmptyScopes ? ContainerUtil.newArrayList() : ContainerUtil.newLinkedHashSet();
     result.add(GlobalSearchScope.projectScope(project));
     if (suggestSearchInLibs) {
       result.add(GlobalSearchScope.allScope(project));