Closed osmano807 closed 4 weeks ago
Leptosfmt removes necessary formatting for prop spreading (new in Leptos 0.7). When trying to format <{..} class="a" /> it removes the .., formatting as <{} class="a" /> and the file doesn't compile anymore:
<{..} class="a" />
..
<{} class="a" />
let form_control = view! { <{..} class="form-control" /> }; let size_class = view! { <{..} class="w-40" /> }; view! { <label {..form_control.clone()} {..size_class.clone()}> </label> }
becomes
let form_control = view! { <{} class="form-control" /> }; let size_class = view! { <{} class="w-40" /> }; view! { <label {..form_control.clone()} {..size_class.clone()}> </label> }
error: expected identifier, found `{` --> file.rs:5:33 | 5 | let form_control = view! { <{} class="form-control" /> }; | ^^ expected identifier
See also https://github.com/leptos-rs/leptos/blob/eba08ad5927478b1d600959abb5513119bccdb26/examples/spread/src/lib.rs for some examples of prop spreading using empty tags.
I've added a PR, I don't know if it's the correct approach to special case this in node_name but it appears to be working.
node_name
Leptosfmt removes necessary formatting for prop spreading (new in Leptos 0.7). When trying to format
<{..} class="a" />
it removes the..
, formatting as<{} class="a" />
and the file doesn't compile anymore:becomes
See also https://github.com/leptos-rs/leptos/blob/eba08ad5927478b1d600959abb5513119bccdb26/examples/spread/src/lib.rs for some examples of prop spreading using empty tags.