languages: Add syntax highlighting for HTML character references#48629
languages: Add syntax highlighting for HTML character references#48629yeskunall merged 1 commit intozed-industries:mainfrom
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @br-schneider on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
We require contributors to sign our Contributor License Agreement, and we don't have @br-schneider on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
yeskunall
left a comment
There was a problem hiding this comment.
Did you test this with an HTML file? I get syntax highlighting for JSX/TSX files, but not HTML files. I tested with all the default themes Zed ships with, so the ones in your list should have worked. Maybe I’m missing something?
|
Yes, I tested with an HTML file and confirmed it works. Here's what I verified:
Since the TSX/JS changes are in built-in languages ( |
|
@yeskunall Just bumping this! Thank you again for reviewing! |
|
@br-schneider apologies -- this slipped through my notifications! Do you mind rebasing onto # You probably have this already
git remote add upstream https://github.com/zed-industries/zed.git
git fetch upstream main
git rebase upstream/main
git push --force-with-lease
|
HTML character references (e.g., `·`, `'`, `&zed-industries#123;`) are parsed by tree-sitter but not captured by any highlight query, so they render as unhighlighted plain text. This adds highlight captures for: - `html_character_reference` in TSX and JavaScript (JSX context) - `entity` in HTML All three are captured as `@string.special`, which is already styled by the built-in themes.
Head branch was pushed to by a user without write access
ee9856d to
0dded3a
Compare
|
No problem! Thanks for taking another look, done! |
|
Thank you @br-schneider and congratulations on your first contribution to Zed! 💖 |
…-industries#48629) HTML character references like `·`, `'`, and `&zed-industries#123;` are correctly parsed by tree-sitter as named nodes (`html_character_reference` in TSX/JavaScript, `entity` in HTML), but no highlight query captures them. This means they render as plain, unhighlighted text in the editor. This PR adds one-line highlight captures for each: - **TSX** (`crates/languages/src/tsx/highlights.scm`): `(html_character_reference) @string.special` - **JavaScript** (`crates/languages/src/javascript/highlights.scm`): `(html_character_reference) @string.special` - **HTML** (`extensions/html/languages/html/highlights.scm`): `(entity) @string.special` `@string.special` is already styled by all built-in themes (One Dark, Ayu, Gruvbox, etc.), so no theme changes are needed. Release Notes: - Added syntax highlighting for HTML character references (`·`, `'`, `&zed-industries#123;`, etc.) in TSX, JavaScript, and HTML files.
HTML character references like
·,', and{are correctly parsed by tree-sitter as named nodes (html_character_referencein TSX/JavaScript,entityin HTML), but no highlight query captures them. This means they render as plain, unhighlighted text in the editor.This PR adds one-line highlight captures for each:
crates/languages/src/tsx/highlights.scm):(html_character_reference) @string.specialcrates/languages/src/javascript/highlights.scm):(html_character_reference) @string.specialextensions/html/languages/html/highlights.scm):(entity) @string.special@string.specialis already styled by all built-in themes (One Dark, Ayu, Gruvbox, etc.), so no theme changes are needed.Release Notes:
·,',{, etc.) in TSX, JavaScript, and HTML files.