Skip to content

KaReferenceShortener

@SubclassOptInRequired(markerClass = [KaSessionComponentImplementationDetail::class])
interface KaReferenceShortener : KaSessionComponent

Inheritors

Properties

token

abstract val token: KaLifetimeToken

The KaLifetimeToken which determines the lifetime of the lifetime owner.

Functions

assertIsValidAndAccessible

collectPossibleReferenceShortenings

abstract fun collectPossibleReferenceShortenings(
    file: KtFile, 
    selection: TextRange = file.textRange, 
    shortenOptions: ShortenOptions = ShortenOptions.DEFAULT, 
    classShortenStrategy: (KaClassLikeSymbol) -> ShortenStrategy = defaultClassShortenStrategy, 
    callableShortenStrategy: (KaCallableSymbol) -> ShortenStrategy = defaultCallableShortenStrategy
): ShortenCommand

Collects possible references to shorten.

See defaultClassShortenStrategy and defaultCallableShortenStrategy for the default shortening logic.

Also see org.jetbrains.kotlin.idea.base.analysis.api.utils.shortenReferences and functions around it.

collectPossibleReferenceShorteningsInElement

abstract fun collectPossibleReferenceShorteningsInElement(
    element: KtElement, 
    shortenOptions: ShortenOptions = ShortenOptions.DEFAULT, 
    classShortenStrategy: (KaClassLikeSymbol) -> ShortenStrategy = defaultClassShortenStrategy, 
    callableShortenStrategy: (KaCallableSymbol) -> ShortenStrategy = defaultCallableShortenStrategy
): ShortenCommand

Collects possible references to shorten in elements text range.

See defaultClassShortenStrategy and defaultCallableShortenStrategy for the default shortening logic.

Also see org.jetbrains.kotlin.idea.base.analysis.api.utils.shortenReferences and functions around it.

isValid

Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.

withValidityAssertion

inline fun <R> KaLifetimeOwner.withValidityAssertion(action: () -> R): R

Executes action only if the KaLifetimeOwner is still valid and accessible. Otherwise, throws a validity exception based on the concrete violation.