Skip to content

KotlinDeclarationProviderMerger

While the main declaration provider created via createDeclarationProvider is scope-based, there are other declaration providers which are not, such as file-based declaration providers. Not all declarations provided by such declaration providers can be provided by the main declaration provider, even if the correct scope is provided (such as a file-based scope). For example, the main declaration provider may be based on an index which doesn't contain the declarations provided by file-based declaration providers.

Hence, KotlinDeclarationProviders cannot just be combined by combining the scopes of all declaration providers and calling createDeclarationProvider. KotlinDeclarationProviderMerger should implement proper merging logic that takes these concerns into account.

The provider merger should consider merging scopes with KaGlobalSearchScopeMerger if there is a useful implementation provided by the platform.

Types

Companion

object Companion

Functions

merge

Merges the given providers into a single provider. When possible, mergers will try to create a provider that is more efficient compared to the naive sequential composite provider. Not all providers might be mergeable, or there might be multiple separate sets of providers that can be merged individually, so the resulting provider may be a composite provider.