mirror of
https://github.com/chylex/IntelliJ-Rainbow-Brackets.git
synced 2025-05-09 15:34:05 +02:00
Initial commit for rainbowify XML/HTML tag name
(cherry picked from commit c958fbf0fec6dd30fce3f669b698a42a1a6ac821)
This commit is contained in:
parent
dc1f04e187
commit
1bab5d6415
screenshots
src
main/kotlin/com/github/izhangzhihao/rainbow/brackets/visitor
test/kotlin/com/github/izhangzhihao/rainbow/brackets
Binary file not shown.
Before ![]() (image error) Size: 67 KiB After ![]() (image error) Size: 96 KiB ![]() ![]() |
@ -8,6 +8,7 @@ import com.intellij.psi.xml.XmlFile
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.psi.xml.XmlToken
|
||||
import com.intellij.psi.xml.XmlTokenType
|
||||
import com.intellij.util.xml.XmlName
|
||||
|
||||
|
||||
open class XmlRainbowVisitor : RainbowHighlightVisitor() {
|
||||
@ -56,6 +57,13 @@ open class XmlRainbowVisitor : RainbowHighlightVisitor() {
|
||||
val endElement = element.takeIf { tokenType == XmlTokenType.XML_CDATA_END }
|
||||
element.level?.let { element.setHighlightInfo(element.parent, it + 1, startElement, endElement) }
|
||||
}
|
||||
|
||||
XmlTokenType.XML_NAME -> {
|
||||
val prevSibling = element.prevSibling
|
||||
if (prevSibling != null && prevSibling is XmlToken) {
|
||||
prevSibling.level?.let { element.setHighlightInfo(element.xmlParent, it, element, null) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,33 +37,44 @@ class RainbowXMLTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
angleLevel(0),
|
||||
|
||||
angleLevel(0),
|
||||
angleLevel(0),//idea-plugin
|
||||
angleLevel(0),
|
||||
|
||||
angleLevel(1),
|
||||
angleLevel(1),//name
|
||||
angleLevel(1),
|
||||
angleLevel(1),
|
||||
angleLevel(1),//name
|
||||
angleLevel(1),
|
||||
|
||||
angleLevel(1),
|
||||
angleLevel(1),//description
|
||||
angleLevel(1),
|
||||
|
||||
angleLevel(2),
|
||||
angleLevel(2),//p
|
||||
angleLevel(2),
|
||||
angleLevel(2),
|
||||
angleLevel(2),//p
|
||||
angleLevel(2),
|
||||
|
||||
angleLevel(2),
|
||||
angleLevel(2),//p
|
||||
angleLevel(2),
|
||||
angleLevel(2),
|
||||
angleLevel(2),//p
|
||||
angleLevel(2),
|
||||
|
||||
angleLevel(2),
|
||||
angleLevel(2),//br
|
||||
angleLevel(2),
|
||||
|
||||
angleLevel(1),
|
||||
angleLevel(1),//description
|
||||
angleLevel(1),
|
||||
|
||||
angleLevel(0),
|
||||
angleLevel(0),//idea-plugin
|
||||
angleLevel(0)
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user