GlobalSearchScope (@NotNull VirtualFile key) { VirtualFile file = key; VirtualFile original = key instanceof LightVirtualFile ? ((LightVirtualFile)key).getOriginalFile() : null; if (original != null) { file = original; } GlobalSearchScope scope = null; for (ResolveScopeProvider resolveScopeProvider : ResolveScopeProvider.EP_NAME.getExtensionList()) { scope = resolveScopeProvider.getResolveScope(file, myProject); if (scope != null) break; } if (scope == null) scope = getInherentResolveScope(file); for (ResolveScopeEnlarger enlarger : ResolveScopeEnlarger.EP_NAME.getExtensionList()) { SearchScope extra = enlarger.getAdditionalResolveScope(file, myProject); if (extra != null) { scope = scope.union(extra); } } if (original != null && !scope.contains(key)) { scope = scope.union(GlobalSearchScope.fileScope(myProject, key)); } return scope; }