From a436f11cafc4db8d6ca0c91bff6f9b8c8b1015cd Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Mon, 26 Jun 2023 14:36:30 +0200 Subject: [PATCH] [Analysis API] Add useful references to reference shortener APIs --- .../api/components/KtReferenceShortener.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/components/KtReferenceShortener.kt b/analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/components/KtReferenceShortener.kt index 12160066ae4..e0ee6e29c2e 100644 --- a/analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/components/KtReferenceShortener.kt +++ b/analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/components/KtReferenceShortener.kt @@ -87,6 +87,11 @@ public interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn { /** * Collects possible references to shorten. By default, it shortens a fully-qualified members to the outermost class and does not * shorten enum entries. + * + * N.B. This API is not implemented for the FE10 implementation! + * For a K1- and K2-compatible API, use [org.jetbrains.kotlin.idea.base.codeInsight.ShortenReferencesFacility]. + * + * Also see [org.jetbrains.kotlin.idea.base.analysis.api.utils.shortenReferences] and functions around it. */ public fun collectPossibleReferenceShortenings( file: KtFile, @@ -103,6 +108,15 @@ public interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn { ) } + /** + * Collects possible references to shorten in [element]s text range. By default, it shortens a fully-qualified members to the outermost + * class and does not shorten enum entries. + * + * N.B. This API is not implemented for the FE10 implementation! + * For a K1- and K2-compatible API, use [org.jetbrains.kotlin.idea.base.codeInsight.ShortenReferencesFacility]. + * + * Also see [org.jetbrains.kotlin.idea.base.analysis.api.utils.shortenReferences] and functions around it. + */ public fun collectPossibleReferenceShorteningsInElement( element: KtElement, classShortenOption: (KtClassLikeSymbol) -> ShortenOption = defaultClassShortenOption,