show "Current File" scope always (WEB-20644)
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Sat, 12 Mar 2016 20:15:58 +0000 (23:15 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Sat, 12 Mar 2016 20:15:58 +0000 (23:15 +0300)
platform/lang-impl/src/com/intellij/psi/search/PredefinedSearchScopeProviderImpl.java

index 9f32bbc326552f9e17dceb8c5e40dbe88ce26ec2..c8282195e3be1b4201b2a2a8681fdb0dbfedb0eb 100644 (file)
@@ -101,10 +101,12 @@ public class PredefinedSearchScopeProviderImpl extends PredefinedSearchScopeProv
             result.add(module.getModuleScope());
           }
         }
-        if (dataContextElement.getContainingFile() != null) {
-          result.add(new LocalSearchScope(dataContextElement, IdeBundle.message("scope.current.file")));
-        }
       }
+      PsiElement[] currentFileScope = PsiElement.EMPTY_ARRAY;
+      if (dataContextElement != null && dataContextElement.getContainingFile() != null) {
+        currentFileScope = new PsiElement[]{dataContextElement};
+      }
+      result.add(new LocalSearchScope(currentFileScope, IdeBundle.message("scope.current.file")));
     }
 
     if (currentSelection) {