Closed zx8 closed 1 year ago
Thanks, this looks like a valid bug. The printer should probably be a bit smarter.
Another very similar case below minimized from https://github.com/mvdan/sh/discussions/950; I think they are all the same bug:
$ shfmt -version
v3.6.0-0.dev.0.20221125121205-436da662a80b
$ cat f.sh
case x in
# doesn't move
c)
foo
;;
# does move!
"")
foo
;;
esac
$ shfmt f.sh
case x in
# doesn't move
c)
foo
;;
# does move!
"")
foo
;;
esac
Notice
# baz
is indented 2 extra spaces, when it shouldn't be.Actual
Expected