I have this as my vscode tmLanguage.json sort of syntax highlighter config:
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Link",
"patterns": [
{
"include": "#nestedtermsexternal"
},
{
"include": "#nestedterms"
},
{
"include": "#terms"
},
{
"include": "#punctuations"
},
{
"include": "#strings"
},
{
"include": "#numbers"
},
{
"include": "#codes"
},
{
"include": "#comments"
}
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.line.number-sign.link",
"match": "\\# .+"
}
]
},
"codes": {
"patterns": [
{
"name": "constant.character.escape.language.link",
"match": "\\#\\w+"
}
]
},
"nestedtermsexternal": {
"patterns": [
{
"name": "entity.language.link",
"begin": "([a-z][a-z0-9]*(?:-[a-z0-9]+)*) ",
"beginCaptures": {
"1": {
"name": "string.quoted.double.link"
}
},
"end": "[,\n]",
"patterns": [
{
"include": "#terms"
},
{
"include": "#strings"
},
{
"include": "#numbers"
},
{
"include": "#codes"
},
{
"include": "#comments"
}
]
}
]
},
"nestedterms": {
"patterns": [
{
"name": "term.language.link",
"begin": "([a-z][a-z0-9]*(?:-[a-z0-9]+)*)(\\()",
"beginCaptures": {
"1": {
"name": "string.quoted.double.link"
},
"2": {
"name": "string.quoted.double.link"
}
},
"end": "\\)",
"endCaptures": {
"0": {
"name": "string.quoted.double.link"
}
},
"patterns": [
{
"include": "#comments"
},
{
"include": "#terms"
},
{
"include": "#strings"
},
{
"include": "#numbers"
},
{
"include": "#codes"
}
]
}
]
},
"terms": {
"patterns": [
{
"name": "term.language.link",
"match": "([a-z][a-z0-9]*(?:-[a-z0-9]+)*)"
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.integer.link",
"match": "\\d+"
},
{
"name": "constant.numeric.decimal.link",
"match": "\\d+\\.\\d+"
}
]
},
"punctuations": {
"patterns": [
{
"name": "punctuation.separator.parameter.link",
"match": ","
}
]
},
"strings": {
"name": "template.link",
"begin": "\\<",
"beginCaptures": {
"0": {
"name": "entity.name.type.link"
}
},
"end": "\\>",
"endCaptures": {
"0": {
"name": "entity.name.type.link"
}
},
"patterns": [
{
"include": "#codes"
},
{
"name": "punctuation.term.link",
"begin": "\\{+",
"beginCaptures": {
"0": {
"name": "entity.name.type.link"
}
},
"end": "\\}+",
"endCaptures": {
"0": {
"name": "entity.name.type.link"
}
},
"patterns": [
{
"include": "#nestedterms"
},
{
"include": "#terms"
},
{
"include": "#numbers"
},
{
"include": "#strings"
},
{
"include": "#punctuations"
},
{
"include": "#codes"
}
]
},
{
"name": "entity.name.type.link",
"match": "[^\\\\{>]+"
}
]
}
},
"scopeName": "source.link"
}
It is giving me this result, using the Dracula theme (I think this might be some code for it).
The color #8BE9FD
is that turquoise/blue color (the angle brackets). The main thing that is weird is it is saying all curly brackets are colored #8BE9FD
, even though they are clearly not. Why is it doing that? How do I get it so all of the curly brackets appear the same color as the angle brackets? What is happening here? Why is it all rainbow (every curly bracket appeared a different color next to each other).
I have \\{+
in the theme syntax highlighter, I simply want to highlight all these the same as the angle brackets. I don't get where it's going wrong, the regexp seems to be working because you can see in the image the curly brackets are all grouped together.
Is it interfering somehow with other plugins? The syntax highlighter is set to my custom extension name, so that appears to be working.
(That image is from using VSCode's scope inspector).
I added this to my package.json, and it worked!