Skip to content

Commit 71bf2d5

Browse files
committed
Shrink use scope for public but local var and const definitions
1 parent 1c870ff commit 71bf2d5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/com/goide/psi/impl/GoNamedElementImpl.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,16 @@ public Icon getIcon(int flags) {
206206
@NotNull
207207
@Override
208208
public SearchScope getUseScope() {
209+
if (this instanceof GoVarDefinition || this instanceof GoConstDefinition) {
210+
GoBlock block = PsiTreeUtil.getParentOfType(this, GoBlock.class);
211+
if (block != null) return new LocalSearchScope(block);
212+
}
209213
if (isPublic()) {
210214
// it's important to ask module on file, otherwise module won't be found for elements in libraries files [zolotov]
211215
Module module = ModuleUtilCore.findModuleForPsiElement(getContainingFile());
212216
return module != null ? GoUtil.moduleScope(getProject(), module) : super.getUseScope();
213217
}
214-
else {
215-
if (this instanceof GoVarDefinition || this instanceof GoConstDefinition) {
216-
GoBlock block = PsiTreeUtil.getParentOfType(this, GoBlock.class);
217-
if (block != null) return new LocalSearchScope(block);
218-
}
219-
return GoPsiImplUtil.packageScope(getContainingFile());
220-
}
218+
return GoPsiImplUtil.packageScope(getContainingFile());
221219
}
222220

223221
@Override

0 commit comments

Comments
 (0)