Since v0.7.4 (commit b6793dc, PR #5257), dx fmt mangles the indentation of commented-out RSX blocks. Two variants:
Variant 1: First line keeps indentation, rest gets dedented
Idempotency test with this input fails:
rsx! {
div {
h2 { "Title" }
// div { class: "wrapper",
- // p { "A" }
- // p { "B" }
- // }
+ // p { "A" }
+ // p { "B" }
+ // }
}
}
Variant 2: Entire block gets dedented (nested rsx!)
rsx! {
Component {
field: rsx! {
div {
h2 { "Title" }
- // div { class: "wrapper",
- // // nested comment
- // p { "A" }
- // }
+ // div { class: "wrapper",
+ // // nested comment
+ // p { "A" }
+ // }
}
},
}
}
Root cause is the rewritten comment-handling in packages/autofmt/src/writer.rs (PR #5257). Commented-out RSX blocks aren't covered by existing tests.
Happy to submit a PR with the test cases (and a fix) if that's helpful.
Since v0.7.4 (commit b6793dc, PR #5257),
dx fmtmangles the indentation of commented-out RSX blocks. Two variants:Variant 1: First line keeps indentation, rest gets dedented
Idempotency test with this input fails:
rsx! { div { h2 { "Title" } // div { class: "wrapper", - // p { "A" } - // p { "B" } - // } + // p { "A" } + // p { "B" } + // } } }Variant 2: Entire block gets dedented (nested rsx!)
rsx! { Component { field: rsx! { div { h2 { "Title" } - // div { class: "wrapper", - // // nested comment - // p { "A" } - // } + // div { class: "wrapper", + // // nested comment + // p { "A" } + // } } }, } }Root cause is the rewritten comment-handling in
packages/autofmt/src/writer.rs(PR #5257). Commented-out RSX blocks aren't covered by existing tests.Happy to submit a PR with the test cases (and a fix) if that's helpful.