Revert "IJPL-846 cleanup"

This reverts commit 34a2ad316b11d5c263094b365a1f439b56090723.

GitOrigin-RevId: 50e4215fcebe32c970deda163ed313dbea6a477f
This commit is contained in:
Vladimir Krivosheev
2024-03-21 21:24:33 +00:00
committed by intellij-monorepo-bot
parent 607fdf5f8e
commit 713660bac7
@@ -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<ParameterHintsState>(project, scope), Disposable {
internal class ParamHintsGrave(project: Project, private val scope: CoroutineScope)
: TextEditorCache<ParameterHintsState>(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<Int, HintData>? {
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<HintData> = 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)