mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cache effective reference search scopes
This commit is contained in:
+6
-2
@@ -38,6 +38,7 @@ public class MethodReferencesSearch extends ExtensibleQueryFactory<PsiReference,
|
||||
private final PsiMethod myMethod;
|
||||
private final Project myProject;
|
||||
private final SearchScope myScope;
|
||||
private volatile SearchScope myEffectiveScope;
|
||||
private final boolean myStrictSignatureSearch;
|
||||
private final SearchRequestCollector myOptimizer;
|
||||
private final boolean isSharedOptimizer;
|
||||
@@ -93,8 +94,11 @@ public class MethodReferencesSearch extends ExtensibleQueryFactory<PsiReference,
|
||||
|
||||
@NotNull
|
||||
public SearchScope getEffectiveSearchScope () {
|
||||
SearchScope accessScope = PsiSearchHelper.SERVICE.getInstance(myMethod.getProject()).getUseScope(myMethod);
|
||||
return myScope.intersectWith(accessScope);
|
||||
SearchScope scope = myEffectiveScope;
|
||||
if (scope == null) {
|
||||
myEffectiveScope = scope = myScope.intersectWith(PsiSearchHelper.SERVICE.getInstance(myMethod.getProject()).getUseScope(myMethod));
|
||||
}
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ReferencesSearch extends ExtensibleQueryFactory<PsiReference, Refer
|
||||
public static class SearchParameters implements DumbAwareSearchParameters {
|
||||
private final PsiElement myElementToSearch;
|
||||
private final SearchScope myScope;
|
||||
private volatile SearchScope myEffectiveScope;
|
||||
private final boolean myIgnoreAccessScope;
|
||||
private final SearchRequestCollector myOptimizer;
|
||||
private final Project myProject;
|
||||
@@ -104,8 +105,13 @@ public class ReferencesSearch extends ExtensibleQueryFactory<PsiReference, Refer
|
||||
if (myIgnoreAccessScope) {
|
||||
return myScope;
|
||||
}
|
||||
SearchScope accessScope = PsiSearchHelper.SERVICE.getInstance(myElementToSearch.getProject()).getUseScope(myElementToSearch);
|
||||
return myScope.intersectWith(accessScope);
|
||||
|
||||
SearchScope scope = myEffectiveScope;
|
||||
if (scope == null) {
|
||||
SearchScope useScope = PsiSearchHelper.SERVICE.getInstance(myElementToSearch.getProject()).getUseScope(myElementToSearch);
|
||||
myEffectiveScope = scope = myScope.intersectWith(useScope);
|
||||
}
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user