0.7 attribute values
Is your feature request related to a problem? Please describe. How attribute values work is slightly inconsistent and rust-analyzer support isn't the best
Describe the solution you'd like This was discussed briefly on discord:
1. Require braces for attribute values except for str/num/bool literals.
Right now you can do attr=arbitrary.expression() + thing - but this requires that the expression after the = is valid - if you write something like arbitrary., the macro won't expand and you don't get any autocomplete suggestions after the ..
This change would require any non-literal expressions to be wrapped in braces, like attr={arbitrary.expression() + thing}. This makes it easier to parse (just take everything inside the {}), providing r-a support even in incomplete expressions.
2. More consistent value shorthands
On HTML attributes, the attribute checked is equivalent to checked=true, while on leptos components, it is checked={checked}.
Make this consistent by making checked always equivalent to checked=true, and {checked} equivalent to checked={checked}.
Both of these changes are also what other frameworks like Svelte does.
Describe alternatives you've considered
staying with the current macro.
Additional context
My own view macro leptos-mview implements these requirements, and does have significantly better r-a support. Feel free to steal parts of my implementation for this change.
I like this!
Yes, I would love a stricter/more consistent view macro aswell
I could see this in 0.7 if someone wants to PR it and we can get a migration aid.
ill have a go at implementing this