RIDER-113376 provider custom Rider search scope, so it uses base project directories instead of content roots

fixes "Go To Implementations" / "Go To Derived Symbols" action


(cherry picked from commit 6b500d09250c5be63e9bcd90e4ca48bcfe913c90)

IJ-MR-146194

GitOrigin-RevId: ca184640fda069a9aee880ca4455ccd588f863fd
This commit is contained in:
Ivan.Yarkov
2024-10-08 13:31:02 +00:00
committed by intellij-monorepo-bot
parent 834bd51951
commit bafdf0b407
6 changed files with 36 additions and 3 deletions
@@ -3306,6 +3306,7 @@ f:com.intellij.openapi.module.impl.scopes.ModuleWithDependenciesScope
- equals(java.lang.Object):Z
- extractFileEnumeration():com.intellij.psi.search.impl.VirtualFileEnumeration
- getDisplayName():java.lang.String
- s:getFileEnumerationUnderRoots(java.util.Collection):com.intellij.psi.search.impl.VirtualFileEnumeration
- getModule():com.intellij.openapi.module.Module
- getRoots():java.util.Collection
- isSearchInLibraries():Z
@@ -55,6 +55,8 @@
serviceImplementation="com.intellij.psi.impl.search.PsiSearchHelperImpl"/>
<projectService serviceInterface="com.intellij.psi.impl.ResolveScopeManager"
serviceImplementation="com.intellij.psi.impl.file.impl.ResolveScopeManagerImpl"/>
<projectService serviceInterface="com.intellij.openapi.module.impl.ModuleScopeProviderFactory"
serviceImplementation="com.intellij.openapi.module.impl.scopes.ModuleScopeProviderFactoryImpl"/>
<projectService serviceInterface="com.intellij.openapi.editor.LazyRangeMarkerFactory"
serviceImplementation="com.intellij.openapi.editor.impl.LazyRangeMarkerFactoryImpl"/>
@@ -0,0 +1,14 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.module.impl.scopes
import com.intellij.openapi.module.Module
import com.intellij.openapi.module.impl.ModuleScopeProvider
import com.intellij.openapi.module.impl.ModuleScopeProviderFactory
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
open class ModuleScopeProviderFactoryImpl : ModuleScopeProviderFactory {
override fun createProvider(module: Module): ModuleScopeProvider {
return ModuleScopeProviderImpl(module)
}
}
@@ -196,7 +196,7 @@ public final class ModuleWithDependenciesScope extends GlobalSearchScope impleme
* Compute a set of ids of all files under {@code roots}
*/
@NotNull
static VirtualFileEnumeration getFileEnumerationUnderRoots(@NotNull Collection<? extends VirtualFile> roots) {
public static VirtualFileEnumeration getFileEnumerationUnderRoots(@NotNull Collection<? extends VirtualFile> roots) {
IntSet result = new IntOpenHashSet();
for (VirtualFile file : roots) {
if (file instanceof VirtualFileWithId) {
@@ -0,0 +1,16 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.module.impl;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import com.intellij.openapi.module.Module;
/**
* Creates module scope provider {@link com.intellij.openapi.module.impl.ModuleScopeProvider} from module.
* The default implementation may be changed in your IDE by overriding this service.
*/
@ApiStatus.Internal
public interface ModuleScopeProviderFactory {
@NotNull
ModuleScopeProvider createProvider(@NotNull Module module);
}
@@ -9,11 +9,11 @@ import com.intellij.ide.plugins.IdeaPluginDescriptorImpl
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.*
import com.intellij.openapi.components.impl.stores.IComponentStore
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.diagnostic.getOrLogException
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.module.Module
import com.intellij.openapi.module.impl.scopes.ModuleScopeProviderImpl
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ex.ProjectEx
import com.intellij.openapi.roots.ExternalProjectSystemRegistry
@@ -62,7 +62,7 @@ open class ModuleImpl @ApiStatus.Internal constructor(
registerServiceInstance(serviceInterface = Module::class.java, instance = this, pluginDescriptor = fakeCorePluginDescriptor)
this.project = project
@Suppress("LeakingThis")
moduleScopeProvider = ModuleScopeProviderImpl(this)
moduleScopeProvider = project.service<ModuleScopeProviderFactory>().createProvider(this)
this.name = name
}