optimization: return LocalSearchScope.EMPTY instead of GlobalSearchScope.EMPTY_SCOPE explicitly to avoid unnecessary FileBasedIndex accesses during search

GitOrigin-RevId: b7cf8f4b4dec2f79f2231b97b091cc0ed7978473
This commit is contained in:
Alexey Kudravtsev
2021-09-15 17:09:43 +02:00
committed by intellij-monorepo-bot
parent 480b4a18eb
commit a897b7c13c
17 changed files with 46 additions and 40 deletions

View File

@@ -86,7 +86,7 @@ public final class MethodReferencesSearch extends ExtensibleQueryFactory<PsiRefe
public SearchScope getEffectiveSearchScope () {
SearchScope scope = myEffectiveScope;
if (scope == null) {
if (!myMethod.isValid()) return GlobalSearchScope.EMPTY_SCOPE;
if (!myMethod.isValid()) return LocalSearchScope.EMPTY;
myEffectiveScope = scope = myScope.intersectWith(PsiSearchHelper.getInstance(myMethod.getProject()).getUseScope(myMethod));
}