diff --git a/src/Fantomas.Tests/PatternMatchingTests.fs b/src/Fantomas.Tests/PatternMatchingTests.fs index 2e8c75b0a9..361e4b9995 100644 --- a/src/Fantomas.Tests/PatternMatchingTests.fs +++ b/src/Fantomas.Tests/PatternMatchingTests.fs @@ -1128,3 +1128,23 @@ match foo with getTriviaFromTokensThemSelves allTokens rest info """ + +[] +let ``multiline application call in match expression, 1352`` () = + formatSourceString + false + """ +match x (Map.tryFind somelongidentifier a + Option.defaultValue longidentifier) with +| _ -> () +""" + config + |> prepend newline + |> should + equal + """ +match x ( + Map.tryFind somelongidentifier a + + Option.defaultValue longidentifier + ) with +| _ -> () +""" diff --git a/src/Fantomas/CodePrinter.fs b/src/Fantomas/CodePrinter.fs index 67f803612f..7704b82575 100644 --- a/src/Fantomas/CodePrinter.fs +++ b/src/Fantomas/CodePrinter.fs @@ -1604,7 +1604,7 @@ and genExpr astContext synExpr ctx = | Match (e, cs) -> atCurrentColumn ( !- "match " - +> genExpr astContext e + +> atCurrentColumnIndent (genExpr astContext e) +> enterNodeTokenByName synExpr.Range WITH // indent 'with' further if trivia was printed so that is appear after the match keyword. +> ifElseCtx lastWriteEventIsNewline (rep 5 !- " ") sepNone