Parsing, highlighting escapes in strings with the current Lezer grammars

Not sure really where to put this, because this isn’t a bug with any specific grammar, nor is it a bug/issue with CodeMirror.

Right now I think most (all?) Lezer grammars don’t mark/highlight string escape sequences. Take the .json grammar - it explicitly parses them but does not highlight them with the escape tag.

Basically, I don’t think I could do highlighting that looks like this:

I could solve it myself with an extension, or forking the grammar/highlighting, etc. But that really does seem inefficient. Is there any reasoning for why escapes in strings aren’t highlighted, or is it just something that hasn’t come up before?

I’m okay with adding highlighting of escapes to languages—the main reason most don’t have is simplicity (requires splitting strings into multiple tokens and properly determining the extent of complicated escapes like \u1234/\u{ffff} etc).

That reasoning makes sense. We have some users who are wanting it, so if the complexity isn’t too bad for your tastes it would be a nice feature to have.

I’m probably not going to work on this, but if you want to submit a pull request for a language you’re interested in I can review.