I'm trying to implement support for a new language in VS Code, using a tmGrammar
json file. In this language variables start with !
, and there is a special reserved variable called !this
in this language.
I want to apply one class to all common variables and other for the !this
variable. I'm doing this in my json file:
"repository": {
"keywords": {
"patterns": [
{
"name": "constant.character",
"match": "(?i)\\b(!this)\\b"
},
{
"name": "variable.other",
"match": "(?i)\\![a-z0-9]+"
},
}
}
But this is coloring both !this
and !someVar
to the same color.
If I change the first rule to (?i)\\b(this)\\b
, without the !
the word this
get colored correctly.
I also tried do change the order of the rules, but now matter what I do makes !this
the same color as common variables.
Is there a problem with the first regular expression?