mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
InlayHints: change presentation before emit event
GitOrigin-RevId: 2503e52e854d12f966468e2f450b0a401faf887f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
012edcdbd7
commit
596e36dfa7
@@ -117,10 +117,10 @@ class InlayHintsSinkImpl<T>(val key: SettingsKey<T>) : InlayHintsSink {
|
||||
val previousPresentation = renderer.presentation
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
newPresentation.addListener(InlayListener(inlay as Inlay<PresentationRenderer>))
|
||||
renderer.presentation = newPresentation
|
||||
if (newPresentation.updateState(previousPresentation)) {
|
||||
newPresentation.fireUpdateEvent(previousPresentation.dimension())
|
||||
}
|
||||
renderer.presentation = newPresentation
|
||||
hints.remove(offset)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class HeavyPresentationTest : LightPlatformCodeInsightFixtureTestCase() {
|
||||
}
|
||||
|
||||
fun testFoldedStateIsNotUpdatedAndStatelessComponentIsUpdated() {
|
||||
val factory = PresentationFactory(myFixture.editor as EditorImpl)
|
||||
val factory = getFactory()
|
||||
|
||||
val old = unwrapFolding(factory.folding(factory.smallText("outerPlaceholder")) {
|
||||
unwrapFolding(factory.folding(factory.smallText("innerPlaceholder")) {factory.smallText("text")})
|
||||
@@ -142,8 +142,7 @@ class HeavyPresentationTest : LightPlatformCodeInsightFixtureTestCase() {
|
||||
}
|
||||
|
||||
fun testFoldedBiState() {
|
||||
val factory = PresentationFactory(myFixture.editor as EditorImpl)
|
||||
with(factory) {
|
||||
with(getFactory()) {
|
||||
val inner = collapsible(
|
||||
prefix = smallText("("),
|
||||
collapsed = smallText("???"),
|
||||
@@ -179,6 +178,18 @@ class HeavyPresentationTest : LightPlatformCodeInsightFixtureTestCase() {
|
||||
}
|
||||
}
|
||||
|
||||
fun testSeqSmallTextChangesWidth() {
|
||||
with(getFactory()) {
|
||||
val initial = roundWithBackground(seq(smallText(": "), smallText("number")))
|
||||
val final = roundWithBackground(seq(smallText(": "), smallText("void")))
|
||||
val requiresUpdate = final.updateState(initial)
|
||||
assertTrue(requiresUpdate)
|
||||
assertTrue(initial.width != final.width)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getFactory() = PresentationFactory(myFixture.editor as EditorImpl)
|
||||
|
||||
private fun unwrapFolding(presentation: InlayPresentation): InlayPresentation {
|
||||
presentation as ChangeOnClickPresentation
|
||||
presentation.state = ChangeOnClickPresentation.State(true)
|
||||
|
||||
Reference in New Issue
Block a user