vscode-tmlanguage icon indicating copy to clipboard operation
vscode-tmlanguage copied to clipboard

[Bug] Unpaired braces in match regex should be ignored

Open svew opened this issue 7 months ago • 0 comments

When writing JSON grammars, the "match", "begin", and "end" regex fields do not ignore open and unmatched braces within the regex, and those braces bleed out of the JSON value.

This creates misleading syntax highlighting.

Example 1

{
    "repository": {
        "x1": {
            "match": "\\[",
            "begin": "\\[",
            "end": "\\["
        },
        "x2": {
            "match": "\\]",
            "begin": "\\]",
            "end": "\\]"
        },
        "y1": {
            "match": "\\}",
            "begin": "\\}",
            "end": "\\}"
        },
        "y2": {
            "match": "\\{",
            "begin": "\\{",
            "end": "\\{"
        }
    }
}
  • Expected behavior: When inside of a regex area, \\[, \\], \\{, //} does not contribute to brace matching
  • Actual beharior: VSCode attempts to match the braces inside \\[, \\], \\{, \\} with other braces in the JSON text

svew avatar Jun 02 '25 17:06 svew