tree-sitter-grammars / tree-sitter-yuck

Eww grammar for tree-sitter
MIT License
3 stars 2 forks source link

feat: add `loop_widget` node support e.g. `(for i in {[1, 2, 3]} (button))` #3

Closed Philipp-M closed 1 year ago

Philipp-M commented 1 year ago

Added support for loop_widget, I think we can add a little bit more fancy syntax highlighting for special nodes (see e.g. https://github.com/elkowar/eww/blob/master/crates/yuck/src/config/widget_use.rs or https://github.com/elkowar/eww/blob/master/crates/yuck/src/config/widget_definition.rs for more details of widgets) @amaanq, can you please test this in nvim? (btw. thanks again for the bigger PR, IDE support/tsserver is now much better)

I'm thinking about maybe adding a few more widgets before I'm creating a release.

amaanq commented 1 year ago

Sorry again...really busy lately, @keyword.coroutine got merged and hopefully @string.documentation + @comment.documentation soon too :), and talks of unifying nvim-treesitter + helix queries have begun! See 3944 in nvim-treesitter

for should be @repeat, in should be @keyword.operator, I'll fix this if I can remember in a bit..

Philipp-M commented 1 year ago

for should be @repeat, in should be @keyword.operator, I'll fix this if I can remember in a bit..

maybe regarding the standardization of the behavior of different editors etc. helix uses @keyword.control.repeat which I think makes more sense than just @repeat. Maybe it would make sense to start with something like this: https://docs.helix-editor.com/themes.html#scopes and try to "standardize" the different scopes (give good descriptions to what each of the scope should cover)

amaanq commented 1 year ago

I believe we're going to mostly move our standard query captures to helix/textmates, and (less likely but still good chance) follow the first wins precedence of queries, and once we do I'll have to rewrite every query in nvim-treesitter.

check latest Neovim issue for more info (don't want to link it here cuz spam in the replies there :) )

Philipp-M commented 1 year ago

Yeah just skimmed over the issues in neovim core and nvim-treesitter, will be interesting where this goes, thanks for the info.

Ok, then keep it for now neovim compatible (so that it's valid for at least one editor), I have my "fork" of the highlights queries for helix anyway already.

amaanq commented 1 year ago

Yeah just skimmed over the issues in neovim core and nvim-treesitter, will be interesting where this goes, thanks for the info.

Ok, then keep it for now neovim compatible (so that it's valid for at least one editor), I have my "fork" of the highlights queries for helix anyway already.

I'm really looking forward to having both editors unify query structure and precedence order, as then other editors like Emacs and Zed can leverage it too 😆