on master help sign in
Fix rendering of function arguments in multiline layout
commitd5a5bf66c0a0571bf1d965d3297bbaf57e5b5340 authorMark Karpov <markkarpov92@gmail.com> dateWed 10 Jun 2020, 14:54 (6 years ago) parent2efc5d3
5 files changed+14−4
CHANGELOG.md+3 data/examples/declaration/value/function/arg-breakpoints-out.hs+3 data/examples/declaration/value/function/arg-breakpoints.hs+3 expected-failures/intero.txt+1−1 src/Ormolu/Printer/Meat/Declaration/Value.hs+4−3
CHANGELOG.md+3
@@ -16,6 +16,9 @@
1616* Added support for formatting linked lists with `(:)` as line terminator.
1717 [Issue 478](https://github.com/tweag/ormolu/issues/478).
1818
19+* Fixed rendering of function arguments in multiline layout. [Issue
20+ 609](https://github.com/tweag/ormolu/issues/609).
21+
1922## Ormolu 0.1.0.0
2023
2124* 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 @@
11Formatting is not idempotent:
2− src/InteractiveUI.hs<rendered>:3708:33
2+ src/InteractiveUI.hs<rendered>:3710:33
33 before: "text \"Try\" <+> doWha"
44 after: "text \"Try\"\n "
55Please, 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
186186 Function name -> p_rdrName name
187187 _ -> return ()
188188 Just ne_pats -> do
189− let combinedSpans =
190− combineSrcSpans' $
191− getLoc <$> ne_pats
189+ let combinedSpans = case style of
190+ Function name -> combineSrcSpans (getLoc name) patSpans
191+ _ -> patSpans
192+ patSpans = combineSrcSpans' (getLoc <$> ne_pats)
192193 indentBody = not (isOneLineSpan combinedSpans)
193194 switchLayout [combinedSpans] $ do
194195 let stdCase = sep breakpoint (located' p_pat) m_pats