How to clear textmate grammar highlighting for variables in strings?

27 views Asked by At

Consider a textmate grammar that colors strings via:

{
    "name": "string.quoted.single.my-language",
    "begin": "'",
    "end": "'",
    "patterns": [
        {
            "include": "#escaping"
        }
    ]
},

and escaping defined as:

{
    "match": "(\\{)(.*?)(\\})",
    "captures": {
        "1": {
            "name": "string.interpolated.escape.my-language"
        },
        "2": {
            "name": "plaintext.my-language"
        },
        "3": {
            "name": "string.interpolated.escape.my-language"
        }
    }
}

The content within the escaped block remains colored the same as the string rather than without color. Is it possible to push a "plaintext" scope on top to remove the highlighting here? If not I assume this needs to be handled by the string pattern then, but I'm not sure how to do that.

Example:

'string content <escaped content with normal highlighting> string content again'

0

There are 0 answers