tree-sitter-templ icon indicating copy to clipboard operation
tree-sitter-templ copied to clipboard

Fix inconsistencies

Open vrischmann opened this issue 9 months ago • 3 comments

Modify the grammar so that style_element is composed of a style_tag_start and style_tag_end just like a regular element is.

So for example instead of having this:

(style_element
  (attribute
    name: (attribute_name)
    value: (quoted_attribute_value
      (attribute_value)))
  (style_element_text))

we now have this:

(style_element
  (style_tag_start
    (attribute
      name: (attribute_name)
      value: (quoted_attribute_value
        (attribute_value))))
  (style_element_text)
  (style_tag_end))

While not strictly necessary for proper syntax highlighting as far as I can tell, it makes more sense semantically to have attributes be under the style_tag_start instead of the whole element.

This fixes #24.

The current nvim-treesitter queries still work fine because the style_element hasn't been removed but just to be consistent I'll add this small patch upstream.

vrischmann avatar May 02 '24 20:05 vrischmann

Hi @danderson. Could you let me know if you need to change anything in the emacs package for this change ? Thank you !

vrischmann avatar May 02 '24 20:05 vrischmann

Thanks for making this change! I can test later today hopefully, it should be an easy fix :crossed_fingers: The main thing I have to figure out is how to query for which grammar variant people have installed, so that I can adapt the queries. I wish treesitter grammars included version info :(

danderson avatar May 02 '24 21:05 danderson

Thanks for making this change! I can test later today hopefully, it should be an easy fix 🤞 The main thing I have to figure out is how to query for which grammar variant people have installed, so that I can adapt the queries. I wish treesitter grammars included version info :(

I'm not familiar with how it works in the emacs world but do you not bind the queries to a specific parser version ?

nvim-treesitter does this by having the git hash of the parser in a lock file so when people update nvim-treesitter with the new queries they'll automatically update the parser as well.

vrischmann avatar May 04 '24 12:05 vrischmann

Hey @danderson, any news on your part ? I'm thinking of merging this as is because as far as I understand since there are no query changes necessary it won't affect the emacs package.

vrischmann avatar Jun 18 '24 22:06 vrischmann