helix
helix copied to clipboard
Expand nested scopes under `tag` capture for more precise syntax highlighting
Currently Helix has the @tag capture/scope (documentation describes it as for "Tags (e.g. <body> in HTML)"), as well as the @tag.builtin nested capture (no description). Neovim has both of these, but also uses @tag.delimiter - described in their documentation as for "XML-style tag delimiters" - and @tag.attribute - "XML-style tag attributes":
https://github.com/nvim-treesitter/nvim-treesitter/blob/42fc28ba918343ebfd5565147a42a26580579482/CONTRIBUTING.md?plain=1#L248-L249
I propose Helix starts using these as well. Instead of the generic punctuation.bracket used for tag delimiters in HTML, we would use tag.delimiter.
https://github.com/helix-editor/helix/blob/62f270e5d2fb34a77dd30a3b2e6b4c9fb6f1cfe1/runtime/queries/html/highlights.scm#L38-L44
This would enable, for example, theming specifically the angle brackets around tags in HTML/XML as we do for Catppuccin syntax highlighting.
Additionally, though not (originally) a priority, it might make sense to take Neovim's @tag.attribute as well, and use that instead of @attribute - whcih Helix describes as for "Class attributes, HTML tag attributes" - for HTML tags. Like Neovim, we can still use the @attribute capture in other places (e.g. just "Class attributes" and not "HTML tag attributes"):
https://github.com/nvim-treesitter/nvim-treesitter/blob/42fc28ba918343ebfd5565147a42a26580579482/CONTRIBUTING.md?plain=1#L143-L144