Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97371

Regular expression for detecting !this not working

$
0
0

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?


Viewing all articles
Browse latest Browse all 97371

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>