Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,47 @@ import org.jetbrains.kotlin.analysis.api.platform.projectStructure.KotlinProject
import org.jetbrains.kotlin.com.intellij.openapi.application.AsyncExecutionService
import org.jetbrains.kotlin.com.intellij.psi.SmartTypePointerManager
import org.jetbrains.kotlin.com.intellij.psi.impl.smartPointers.SmartTypePointerManagerImpl
import org.jetbrains.kotlin.load.java.structure.impl.source.JavaElementSourceFactory
import org.jetbrains.kotlin.load.java.structure.impl.source.JavaFixedElementSourceFactory

@Suppress("UnstableApiUsage")
@OptIn(KaImplementationDetail::class)
internal object AnalysisApiServiceProviders {
val BaseProvider =
AnalysisApiServiceProvider
.Builder()
.apply {
pluginRelativePath = "/META-INF/kt-lsp/kt-lsp.xml"

val BaseProvider = AnalysisApiServiceProvider.Builder().apply {
pluginRelativePath = "/META-INF/kt-lsp/kt-lsp.xml"
appService(KotlinAnalysisPermissionOptions::class, AnalysisPermissionOptions::class)
appService(AsyncExecutionService::class, NoOpAsyncExecutionService::class)

appService(KotlinAnalysisPermissionOptions::class, AnalysisPermissionOptions::class)
appService(AsyncExecutionService::class, NoOpAsyncExecutionService::class)
projectService(
KotlinLifetimeTokenFactory::class,
KotlinReadActionConfinementLifetimeTokenFactory::class,
)

projectService(
KotlinLifetimeTokenFactory::class,
KotlinReadActionConfinementLifetimeTokenFactory::class
)
projectService(KotlinPlatformSettings::class, PlatformSettings::class)
projectService(SmartTypePointerManager::class, SmartTypePointerManagerImpl::class)
projectService(KotlinProjectStructureProvider::class, ProjectStructureProvider::class)
projectService(KotlinModuleDependentsProvider::class, ModuleDependentsProvider::class)
projectService(KotlinModificationTrackerFactory::class, ModificationTrackerFactory::class)
projectService(KotlinAnnotationsResolverFactory::class, AnnotationsResolverFactory::class)
projectService(KotlinDeclarationProviderMerger::class, DeclarationProviderMerger::class)
projectService(KotlinPackageProviderMerger::class, PackageProviderMerger::class)
projectService(KotlinPackagePartProviderFactory::class, PackagePartProviderFactory::class)
projectService(KotlinPackageProviderFactory::class, PackageProviderFactory::class)
projectService(KotlinDeclarationProviderFactory::class, DeclarationProviderFactory::class)

projectService(KotlinPlatformSettings::class, PlatformSettings::class)
projectService(SmartTypePointerManager::class, SmartTypePointerManagerImpl::class)
projectService(KotlinProjectStructureProvider::class, ProjectStructureProvider::class)
projectService(KotlinModuleDependentsProvider::class, ModuleDependentsProvider::class)
projectService(KotlinModificationTrackerFactory::class, ModificationTrackerFactory::class)
projectService(KotlinAnnotationsResolverFactory::class, AnnotationsResolverFactory::class)
projectService(KotlinDeclarationProviderMerger::class, DeclarationProviderMerger::class)
projectService(KotlinPackageProviderMerger::class, PackageProviderMerger::class)
projectService(KotlinPackagePartProviderFactory::class, PackagePartProviderFactory::class)
projectService(KotlinPackageProviderFactory::class, PackageProviderFactory::class)
projectService(KotlinDeclarationProviderFactory::class, DeclarationProviderFactory::class)
}.build()
// analysis-api-impl-base.xml maps this to JavaElementSourceWithSmartPointerFactory, which holds
// library PSI only through a weak/soft SmartPsiElementPointer. Smart pointers exist to survive
// VFS invalidation of library PSI, which a standalone LSP never does - so on a phone the cls PSI
// is simply collected under heap pressure and the pointer cannot re-derive it, and FIR resolution
// throws "Cannot restore ..." (ADFA-6199). The fixed factory keeps the PSI in a plain field; it
// is what the Kotlin CLI compiler registers for its own MockProject. Registered here so it lands
// after the plugin XML and replaces it.
projectService(JavaElementSourceFactory::class, JavaFixedElementSourceFactory::class)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
hal-eisen-adfa marked this conversation as resolved.
}.build()

val Production = BaseProvider
}
}
Loading