Classify template braces as special braces #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi @marijnh ! 👋
Not sure if I did this correctly (and also not sure whether you want to accept this change), but I thought I'd give it a try to classify template braces (including the starting dollar brace) as a "special brace".
I did this by looking at the Lezer parser grammar for JavaScript and finding that there was this
templateDollarBraceandtemplateClosingBrace.github.com/lezer-parser/javascript@afdc2da197/src/javascript.grammar (L442)However, I'm not sure if those are accessible how I have it in this PR.
If you are amenable to this change, but it is not working, feel free to let me know and I can fix it (I may need a bit of a hint how).
This is to improve the communication to developers that the dollar and braces are not a string literal part of the template string (and also improve the color contrast):
Prism.js / VS Code:
CodeMirror:
That node, because it doesn't start with an upper-case letter, wasn't included in the tree, and thus can't be styled. Attached patches should add this properly.
Ah great, thanks! Would this be included in a new version soon (I'm assuming either
@codemirror/lang-javascript@0.19.7or@codemirror/lang-javascript@0.20.0)?I looked in the current version
0.19.6, but I couldn't see it: https://unpkg.com/browse/@codemirror/lang-javascript@0.19.6/dist/index.jsI've tagged @codemirror/lang-javascript 0.19.7 and @lezer/javascript 0.15.3
Thanks for publishing! Just tried it out in
github.com/upleveled/theme-vs-code-dark-plus@b3fdce6106, works! 🙌Pull request closed