diff --git a/src/Fantomas.Tests/LambdaTests.fs b/src/Fantomas.Tests/LambdaTests.fs index f47fe6754a..5f96a03b4a 100644 --- a/src/Fantomas.Tests/LambdaTests.fs +++ b/src/Fantomas.Tests/LambdaTests.fs @@ -1069,3 +1069,26 @@ leadingExpressionIsMultiline | Ok _ -> true | Error _ -> false) """ + +[] +let ``multiline lambda argument, 1922`` () = + formatSourceString + false + """ +let g = + Array.groupBy + (fun { partNumber = p + revisionNumber = r + processName = pn } -> p, r, pn) +""" + config + |> prepend newline + |> should + equal + """ +let g = + Array.groupBy + (fun { partNumber = p + revisionNumber = r + processName = pn } -> p, r, pn) +""" diff --git a/src/Fantomas/CodePrinter.fs b/src/Fantomas/CodePrinter.fs index 1f65697564..9ae540eb14 100644 --- a/src/Fantomas/CodePrinter.fs +++ b/src/Fantomas/CodePrinter.fs @@ -2211,7 +2211,7 @@ and genExpr astContext synExpr ctx = +> indent +> sepNln +> col sepNln es (genExpr astContext) - +> sepNln + +> onlyIfNot (List.isEmpty es) sepNln +> (sepOpenTFor lpr +> (!- "fun " +> col sepSpace pats (genPat astContext)