diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hints/ParameterHintsEditorInitializer.kt b/platform/lang-impl/src/com/intellij/codeInsight/hints/ParameterHintsEditorInitializer.kt index 01950060de22..75a307c53d81 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hints/ParameterHintsEditorInitializer.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/hints/ParameterHintsEditorInitializer.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.hints import com.intellij.codeInsight.daemon.impl.HintRenderer @@ -45,8 +45,10 @@ internal class ParameterHintsEditorInitializer : TextEditorInitializer { } @Service(Level.PROJECT) -private class ParamHintsGrave(project: Project, private val scope: CoroutineScope) - : TextEditorCache(project, scope), Disposable { +internal class ParamHintsGrave(project: Project, private val scope: CoroutineScope) + : TextEditorCache(project, scope), + Disposable +{ override fun namePrefix() = "persistent-parameter-hints" override fun valueExternalizer() = ParameterHintsState.Externalizer override fun useHeapCache() = true @@ -85,11 +87,10 @@ private class ParamHintsGrave(project: Project, private val scope: CoroutineScop private fun Inlay<*>.toHintData(): Pair? { val renderer = this.renderer as? HintRenderer val text = renderer?.text - if (renderer != null && text != null) { - return Pair(offset, HintData(text, isRelatedToPrecedingText, renderer.widthAdjustment)) - } - else { - return null + return if (renderer != null && text != null) { + Pair(offset, HintData(text, isRelatedToPrecedingText, renderer.widthAdjustment)) + } else { + null } } @@ -109,8 +110,7 @@ private class ParamHintsGrave(project: Project, private val scope: CoroutineScop val list: MutableList = hintMap.getOrPut(offset) { ArrayList() } if (isDebug()) { list.add(debugHintData(hint)) - } - else { + } else { list.add(hint) } } @@ -122,8 +122,7 @@ private class ParamHintsGrave(project: Project, private val scope: CoroutineScop val colonIndex = text.lastIndexOf(':') val debugText = if (colonIndex == -1) { "$text?" - } - else { + } else { text.substring(0, colonIndex) + "?:" } return HintData(debugText, hintData.relatesToPrecedingText, hintData.widthAdjustment)