Skip to content

Commit

Permalink
Always add a space for multiple curried args invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
janus authored and knocte committed Feb 12, 2022
1 parent 2f05dae commit 5a393d1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Fantomas.Tests/SingleExprTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,22 @@ let ``comment after address of tokens`` () =
&& // comment
foobar
"""

[<Test>]
let ``function invocation with multiple curried parameters`` () =
formatSourceString
false
"""
module Foo =
let Bar (baz1: int) (baz2: string) (baz3: string) (baz4: string) =
FooBarBaz(someFunc x) (someOtherFunc y)
"""
config
|> prepend newline
|> should
equal
"""
module Foo =
let Bar (baz1: int) (baz2: string) (baz3: string) (baz4: string) =
FooBarBaz (someFunc x) (someOtherFunc y)
"""
4 changes: 4 additions & 0 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3215,6 +3215,10 @@ and genApp astContext e es ctx =
(fun ctx ->
match es with
| [] -> false
| Paren _ :: rest when es.Length > 1 ->
match rest with
| Paren _ :: _ -> true
| _ -> addSpaceBeforeParensInFunCall e es.Head ctx
| [ h ]
| h :: _ -> addSpaceBeforeParensInFunCall e h ctx)
sepSpace
Expand Down

0 comments on commit 5a393d1

Please sign in to comment.