AT-1085 Validate traffic light renderer on highlighting stop/cancel

GitOrigin-RevId: c0ee250814649f2d78ac4b77f9e2e04caaf75546
This commit is contained in:
Alexey Kryuchkov
2024-11-27 08:40:34 +00:00
committed by intellij-monorepo-bot
parent d3faa0c40d
commit f441ff7ad0
@@ -16,6 +16,7 @@ import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.EditorKind
import com.intellij.openapi.editor.event.BulkAwareDocumentListener
import com.intellij.openapi.editor.event.DocumentEvent
import com.intellij.openapi.editor.ex.EditorMarkupModel
import com.intellij.openapi.extensions.ExtensionNotApplicableException
import com.intellij.openapi.fileEditor.*
import com.intellij.openapi.fileEditor.ex.FileEditorWithProvider
@@ -49,6 +50,10 @@ private fun Collection<FileEditor>.getWorthy(): List<TextEditor> {
}
}
private fun isTrafficLightExists(editor: Editor): Boolean = (editor.markupModel as EditorMarkupModel).errorStripeRenderer != null
private fun checkTrafficLightRenderer() = java.lang.Boolean.getBoolean("is.test.traffic.light")
internal class WaitForFinishedCodeAnalysis(text: String, line: Int) : PerformanceCommandCoroutineAdapter(text, line) {
companion object {
const val PREFIX = CMD_PREFIX + "waitForFinishedCodeAnalysis"
@@ -282,6 +287,11 @@ class CodeAnalysisStateListener(val project: Project, val cs: CoroutineScope) {
while (iterator.hasNext()) {
val (editor, exceptionWithTime) = iterator.next()
val highlightedEditor = highlightedEditors[editor]
if (checkTrafficLightRenderer()) {
assert(isTrafficLightExists(editor.editor)) { "Highlighting traffic light should be shown in the top right corner of the editor, in case of $status" }
}
if (highlightedEditor == null) {
if (!UIUtil.isShowing(editor.getComponent())) {
iterator.remove()