Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow escaped quote literals in the SyntaxScopeMap #19336
As raised by @Ben3eeE in atom/language-json#68 (comment), we are currently unable to apply decorative syntax scopes to
In this PR, I add some special handling for escaped
Unfortunately, these selectors are themselves expressed as strings within CSON or JSON files in our grammars. That means the escaping gets a bit intense, and looks like this:
'string > "\\""': 'puncuation.quote.double.whatever'
Notice that I include 2 backslashes when escaping the quote so that they end up getting passed through to the parser as a single
Anyway, once properly escaped, the quote literal is handled by the parser, but the value it spits out continues to include the escaping backslash. In order to match the text of the anonymous nodes returned by TreeSitter, we need to remove the escaping after trimming off the outer quotes.
@Ben3eeE hopefully this gives you what you need to style quotes properly in various grammars.
maxbrunsfeld left a comment
It's not surprising that there are some gotchas with the CSS-within-CSON approach I went with here
As an aside - We've since developed a system where you write this stuff in regular css files, and the CSS files get compiled ahead-of-time into JSON state machines that let you match the properties even more efficiently than the