Closed ChrisRenfrow closed 1 year ago
I think this could be even more general and work with the syn_rsx
crate for example. I have never written any tree-sitter grammar and I don't know how we would detect when rsx
/html
is used. I know multiple rust web frameworks would benefit from this.
It's popular, sure, but not something to be added in the main grammar. You can try to implement injections similar to how nvim-treesitter does it instead
If this were to be added, then adding every other "style" of macros for any semi popular lib will be advocated for as this would set a precedence. So for that reason, it shouldn't be added
@ChrisRenfrow can you share your grammar?
My apologies, I haven't started anything in regards to this issue and I don't have the time to contribute as I previously indicated. If anyone with the time to commit to this task would like to pick it up they're more than welcome to do so!
@ChrisRenfrow actually, my bad, I read "While I've HAVE written my own tree-sitter grammar..." 🤦🏽♂️
Yew, a front-end web-framework for Rust similar to React, contains a
html!
macro for writing HTML and SVG code declaratively. I believe it makes sense to add support for these blocks in tree-sitter-rust, just as tree-sitter-javascript supports JavaScript syntax extension (jsx) to a similar end.Here is Yew's documentation on how the grammar within
html!
differs from proper HTML.While I've never written my own tree-sitter grammar, I am more than willing to take-on the implementation of this enhancement. If anybody has some time to spare I would appreciate some pointers on how to get started, otherwise I'm sure I can manage on my own. :)My availability has changed since I proposed this change and I can no longer contribute as I had offered.