-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kotlin] Refactor KotlinResolveScopeEnlarger interop.
Move the functionality that allows K1 `KotlinResolveScopeEnlarger`s to work with the AA `IdeKotlinByModulesResolutionScopeProvider` into its own dedicated `IdeKotlinResolveScopeEnlargerBridge`. This will ensure that K1 and AA resolve-scope enlargers are treated the same.
- Loading branch information
1 parent
282009d
commit 1a0814f
Showing
5 changed files
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...org/jetbrains/kotlin/idea/base/analysisApiPlatform/IdeKotlinResolveScopeEnlargerBridge.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. | ||
package org.jetbrains.kotlin.idea.base.analysisApiPlatform | ||
|
||
import com.intellij.psi.search.GlobalSearchScope | ||
import org.jetbrains.kotlin.analysis.api.platform.projectStructure.KotlinResolutionScopeEnlarger | ||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaModule | ||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaSourceModule | ||
import org.jetbrains.kotlin.idea.base.projectStructure.KaSourceModuleKind | ||
import org.jetbrains.kotlin.idea.base.projectStructure.KotlinResolveScopeEnlarger | ||
import org.jetbrains.kotlin.idea.base.projectStructure.openapiModule | ||
import org.jetbrains.kotlin.idea.base.projectStructure.sourceModuleKind | ||
|
||
/** Bridges FE1.0 [KotlinResolveScopeEnlarger] to AA [KotlinResolutionScopeEnlarger]. */ | ||
class IdeKotlinResolveScopeEnlargerBridge : KotlinResolutionScopeEnlarger { | ||
override fun getAdditionalResolutionScope(module: KaModule): GlobalSearchScope? { | ||
if (module !is KaSourceModule) return null | ||
|
||
return KotlinResolveScopeEnlarger.enlargeScope( | ||
GlobalSearchScope.EMPTY_SCOPE, | ||
module.openapiModule, | ||
isTestScope = module.sourceModuleKind == KaSourceModuleKind.TEST, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters