Skip to content

org.jetbrains.kotlin.analysis.api.session

Types

KaSessionProvider

@SubclassOptInRequired(markerClass = [KaImplementationDetail::class])
abstract class KaSessionProvider(val project: Project) : Disposable

Provides KaSessions by use-site PsiElements or KaModules.

Properties

analysisScope

context(session: KaSession)
val analysisScope: GlobalSearchScope

A GlobalSearchScope which spans the files that can be analyzed by the current KaSession.

useSiteModule

context(session: KaSession)
val useSiteModule: KaModule

The KaModule from whose perspective the analysis is performed. The use-site module defines the resolution scope of the KaSession, which signifies where symbols are located (such as sources, dependencies, and so on) and which symbols can be found in the first place.

useSiteSession

context(session: KaSession)
val useSiteSession: KaSession

The KaSession of the current analysis context.

Functions

analyze

inline fun <R> analyze(useSiteElement: PsiElement, action: context(KaSession) () -> R): R

Executes the given action in an analysis session context.

inline fun <R> analyze(useSiteModule: KaModule, action: context(KaSession) () -> R): R

Executes the given action in an analysis session context.

analyzeCopy

inline fun <R> analyzeCopy(
    useSiteElement: KtElement, 
    resolutionMode: KaDanglingFileResolutionMode, 
    crossinline action: context(KaSession) () -> R
): R

Executes the given action in a KaSession context.

canBeAnalysed

context(session: KaSession)
fun PsiElement.canBeAnalysed(): Boolean

Checks whether the PsiElement is inside the analysisScope.