GlobalSearchScope (@NotNull GlobalSearchScope scope) { Project project = Objects.requireNonNull(scope.getProject()); Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk(); // TODO cache the scope in project userdata (update when SDK paths change or different project SDK is selected) if (sdk != null && PythonSdkUtil.isPythonSdk(sdk)) { return scope.intersectWith(PySearchScopeBuilder.forPythonSdk(project, sdk) .excludeStandardLibraryTests() .excludeThirdPartyPackageTypeShedStubs() .build()); } return scope; }