Improve rendering of comments around if expressions
commita5c4d6c439b01648cc44e307e0fe10e1a55c9bd5
authorMark Karpov <markkarpov92@gmail.com>
dateMon 11 May 2020, 14:57 (6 years ago)
parent0617326
CHANGELOG.md+3
@@ -25,6 +25,9 @@
2525 multiple blank lines in a row. [Issue
2626 518](https://github.com/tweag/ormolu/issues/518).
2727
28+* Fixed rendering of comment around if expressions. [Issue
29+ 458](https://github.com/tweag/ormolu/issues/458).
30+
2831* Renamed the `--check-idempotency` flag to `--check-idempotence`.
2932 Apparently only the latter is correct.
3033
data/examples/declaration/value/function/if-with-comment-out.hsnew file+8
@@ -0,0 +1,8 @@
1+foo =
2+ if undefined
3+ then -- then comment
4+ undefined
5+ else -- else comment
6+
7+ do
8+ undefined
data/examples/declaration/value/function/if-with-comment.hsnew file+8
@@ -0,0 +1,8 @@
1+foo =
2+ if undefined
3+ -- then comment
4+ then undefined
5+ -- else comment
6+ else
7+ do
8+ undefined
src/Ormolu/Printer/Meat/Declaration/Value.hs+2
@@ -904,10 +904,12 @@ p_if placer render if' then' else' = do
904904 breakpoint
905905 inci $ do
906906 txt "then"
907+ space
907908 located then' $ \x ->
908909 placeHanging (placer x) (render x)
909910 breakpoint
910911 txt "else"
912+ space
911913 located else' $ \x ->
912914 placeHanging (placer x) (render x)
913915