Hacker News new | past | comments | ask | show | jobs | submit login

> The jsx stuff looks fancy, but it completely breaks Rust Analyzer

That's not inherent of macros, but how the parser of the macro body is written. Ideally, the jsx code would be transformed to correct Rust code even on broken input, then Rust Analyzer would map the tokens from the expansion to the tokens from the source code to have context for IDE features (rename, autocompletion, go to definition, etc).

I wrote some stuff [1]. It's a bit all over the place since I'm very bad at writing. Here's also a thread with Rust Analyzer's developers [2]

[1]: https://blog.emi0x7d1.dev/improving-autocompletion-in-your-r... [2]: https://www.reddit.com/r/rust/comments/16x2kzi/improving_aut...




The problem is that you also sometimes need to inspect output tokens that occur between (or that don't logically map to tokens between) the input tokens. I ran into this with Leptos. It's just a bad idea. Floem shows that you can have something that looks awfully similar to HTML, without the unnecessary complexity (and compile times) of JSX macros.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: