revert "markdown:avoid highlighting the same range twice"

GitOrigin-RevId: b0e978f7c8c095edf403fac41b6195bb6e5474c2
This commit is contained in:
Alexey Kudravtsev
2025-04-09 16:19:42 +02:00
committed by intellij-monorepo-bot
parent 6babddcabe
commit fbb066d967

View File

@@ -72,11 +72,16 @@ class MarkdownHighlightingAnnotator : Annotator {
private fun PsiElement.traverseAndCreateAnnotationsForContent(holder: AnnotationHolder, textAttributesKey: TextAttributesKey) {
val contentRanges = mutableListOf<TextRange>()
val type = elementType
if (type !is OuterLanguageElementType && firstChild == null) {
contentRanges.add(textRange)
}
accept(object : PsiRecursiveElementVisitor() {
override fun visitElement(element: PsiElement) {
val type = element.elementType
if (type !is OuterLanguageElementType && element.firstChild == null) {
contentRanges.add(element.textRange)
}
super.visitElement(element)
}
})
/**
* If an original sequence was separated by [OuterLanguageElementType]s, then there are several ranges.
* In other cases, the result contains one element.