refactor waitForIdentifierHighlighting (part of IJPL-183582 port IdentifierHighlightingPass to the frontend)

GitOrigin-RevId: bb68a20c6f50ca65221ae77b574f52744c71335b
This commit is contained in:
Alexey Kudravtsev
2025-05-08 14:53:38 +00:00
committed by intellij-monorepo-bot
parent 788e2246e0
commit 9c989a578d
11 changed files with 29 additions and 25 deletions
@@ -174,7 +174,7 @@ class IdeaDecompilerTest : LightJavaCodeInsightFixtureTestCase() {
fun testHighlighting() {
myFixture.setReadEditorMarkupModel(true)
IdentifierHighlighterPassFactory.doWithHighlightingEnabled(project, Runnable {
IdentifierHighlighterPassFactory.doWithIdentifierHighlightingEnabled(project, Runnable {
myFixture.openFileInEditor(getTestFile("Navigation.class"))
myFixture.editor.caretModel.moveToOffset(offset(8, 14)) // m2(): usage, declaration
assertEquals(2, highlightUnderCaret().size)
@@ -196,7 +196,7 @@ class IdeaDecompilerTest : LightJavaCodeInsightFixtureTestCase() {
fun testNameHighlightingInsideCompiledFile() {
myFixture.setReadEditorMarkupModel(true)
myFixture.openFileInEditor(getTestFile("NamesHighlightingInsideCompiledFile.class"))
IdentifierHighlighterPassFactory.doWithHighlightingEnabled(project, Runnable {
IdentifierHighlighterPassFactory.doWithIdentifierHighlightingEnabled(project, Runnable {
val infos = myFixture.doHighlighting()
assertTrue(infos.toString(), infos.all { info: HighlightInfo -> info.severity === HighlightInfoType.SYMBOL_TYPE_SEVERITY })
assertEquals(68, infos.size)
@@ -206,7 +206,7 @@ class IdeaDecompilerTest : LightJavaCodeInsightFixtureTestCase() {
fun testNameHighlightingInsideCompiledModuleFile() {
myFixture.setReadEditorMarkupModel(true)
myFixture.openFileInEditor(getTestFile("module-info.class"))
IdentifierHighlighterPassFactory.doWithHighlightingEnabled(project, Runnable {
IdentifierHighlighterPassFactory.doWithIdentifierHighlightingEnabled(project, Runnable {
val infos = myFixture.doHighlighting()
.filter { it.severity === HighlightInfoType.SYMBOL_TYPE_SEVERITY }
assertEquals(5, infos.size)
@@ -225,7 +225,7 @@ class IdeaDecompilerTest : LightJavaCodeInsightFixtureTestCase() {
val testFile = getTestFile("RecordHighlighting.class")
testFile.parent.children; testFile.parent.refresh(false, true) // inner classes
myFixture.openFileInEditor(testFile)
IdentifierHighlighterPassFactory.doWithHighlightingEnabled(project, Runnable {
IdentifierHighlighterPassFactory.doWithIdentifierHighlightingEnabled(project, Runnable {
val infos = myFixture.doHighlighting()
.filter { it.severity === HighlightInfoType.SYMBOL_TYPE_SEVERITY }
val texts = infos.map { it.text }.toSet()
@@ -239,7 +239,7 @@ class IdeaDecompilerTest : LightJavaCodeInsightFixtureTestCase() {
}
private fun highlightUnderCaret(): List<HighlightInfo> {
IdentifierHighlighterPassFactory.waitForIdentifierHighlighting()
IdentifierHighlighterPassFactory.waitForIdentifierHighlighting(editor)
return myFixture.doHighlighting().filter { it.severity === HighlightInfoType.ELEMENT_UNDER_CARET_SEVERITY }
}