on master help sign in
Fix rendering of function arguments in multiline layout
d5a5bf6Mark Karpov
CHANGELOG.md+3
@@ -16,6 +16,9 @@
16* Added support for formatting linked lists with `(:)` as line terminator.
16* Added support for formatting linked lists with `(:)` as line terminator.
17 [Issue 478](https://github.com/tweag/ormolu/issues/478).
17 [Issue 478](https://github.com/tweag/ormolu/issues/478).
18
18
19+* Fixed rendering of function arguments in multiline layout. [Issue
20+ 609](https://github.com/tweag/ormolu/issues/609).
21+
19## Ormolu 0.1.0.0
22## Ormolu 0.1.0.0
20
23
21* Fixed rendering of type signatures concerning several identifiers. [Issue
24* Fixed rendering of type signatures concerning several identifiers. [Issue
data/examples/declaration/value/function/arg-breakpoints-out.hsnew file+3
@@ -0,0 +1,3 @@
1+foo
2+ bar =
3+ body
data/examples/declaration/value/function/arg-breakpoints.hsnew file+3
@@ -0,0 +1,3 @@
1+foo
2+ bar =
3+ body
expected-failures/intero.txt+1−1
@@ -1,5 +1,5 @@
1Formatting is not idempotent:
1Formatting is not idempotent:
2− src/InteractiveUI.hs<rendered>:3708:33
2+ src/InteractiveUI.hs<rendered>:3710:33
3 before: "text \"Try\" <+> doWha"
3 before: "text \"Try\" <+> doWha"
4 after: "text \"Try\"\n "
4 after: "text \"Try\"\n "
5Please, consider reporting the bug.
5Please, consider reporting the bug.
src/Ormolu/Printer/Meat/Declaration/Value.hs+4−3
@@ -186,9 +186,10 @@ p_match' placer render style isInfix strictness m_pats GRHSs {..} = do
186 Function name -> p_rdrName name
186 Function name -> p_rdrName name
187 _ -> return ()
187 _ -> return ()
188 Just ne_pats -> do
188 Just ne_pats -> do
189− let combinedSpans =
189+ let combinedSpans = case style of
190+ Function name -> combineSrcSpans (getLoc name) patSpans
191+ _ -> patSpans
190− combineSrcSpans' $
192+ patSpans = combineSrcSpans' (getLoc <$> ne_pats)
191− getLoc <$> ne_pats
192 indentBody = not (isOneLineSpan combinedSpans)
193 indentBody = not (isOneLineSpan combinedSpans)
193 switchLayout [combinedSpans] $ do
194 switchLayout [combinedSpans] $ do
194 let stdCase = sep breakpoint (located' p_pat) m_pats
195 let stdCase = sep breakpoint (located' p_pat) m_pats