rescript-compiler
rescript-compiler copied to clipboard
switch-branch with multi-match branch is formatted weirdly
switch 0 {
// Something something
| 0
// Another something
| 1 =>
let foo = 123
doSomethingInteresting(foo)
}
formats to:
switch 0 {
// Something something
| 0
| // Another something
1 =>
let foo = 123
doSomethingInteresting(foo)
}
which likely doesn't match the intention here. in general i dislike that the formatter is throwing my comments around and won't let me place them as i want to.
as an added bonus, it's takes multiple formats to make this stable:
switch 0 {
| 0 // Something something
| 1 // Another something
=>
let foo = 123
doSomethingInteresting(foo)
}
format once:
switch 0 {
| 0 // Something something
| 1 => // Another something
let foo = 123
doSomethingInteresting(foo)
}
format twice:
switch 0 {
| 0 // Something something
| 1 =>
// Another something
let foo = 123
doSomethingInteresting(foo)
}
Thanks for reporting this, we should probably keep track of the | in Ppat_or and attach the comment accordingly.