From 41ca07cf4c48a6e01e075d14bff7bb8bf3017dc2 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Fri, 29 Aug 2025 12:58:07 +0200 Subject: [PATCH] mark CompletionPhase as sealed GitOrigin-RevId: 9a04aa432d291a2adb19e7d71152eabbd2e02788 --- .../codeInsight/completion/CompletionPhase.kt | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.kt b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.kt index 02fe522554f4..f9f0429ad6b7 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionPhase.kt @@ -53,7 +53,7 @@ import kotlin.math.max * * [InsertedSingleItem] - a single item was found, and it was inserted into the document * * [NoSuggestionsHint] - candidate inference has finished, but no candidates were found and a warning "no suggestions found" is shown. */ -abstract class CompletionPhase @ApiStatus.Internal protected constructor( +sealed class CompletionPhase @ApiStatus.Internal constructor( @JvmField val indicator: CompletionProgressIndicator? ) : Disposable { @@ -374,6 +374,16 @@ abstract class CompletionPhase @ApiStatus.Internal protected constructor( } } + private object NoCompletionImpl: CompletionPhase(null) { + override fun newCompletionStarted(time: Int, repeated: Boolean): Int { + return time + } + + override fun toString(): String { + return "NoCompletion" + } + } + @ApiStatus.Internal companion object { @ApiStatus.Internal @@ -385,15 +395,7 @@ abstract class CompletionPhase @ApiStatus.Internal protected constructor( val CUSTOM_CODE_COMPLETION_ACTION_ID: Key = Key.create("CodeCompletionActionID") @JvmField - val NoCompletion: CompletionPhase = object : CompletionPhase(null) { - override fun newCompletionStarted(time: Int, repeated: Boolean): Int { - return time - } - - override fun toString(): String { - return "NoCompletion" - } - } + val NoCompletion: CompletionPhase = NoCompletionImpl } }