Skip to content

Commit

Permalink
Add comma at EOL for member/ctor tuples (#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobface committed May 19, 2020
1 parent 492764e commit 4c8aeb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/Fantomas.Tests/TypeDeclarationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,8 @@ let ``long type members should have parameters on separate lines, 719`` () =
|> should equal """
type C () =
member __.LongMethodWithLotsOfParameters(
aVeryLongType: AVeryLongTypeThatYouNeedToUse
aSecondVeryLongType: AVeryLongTypeThatYouNeedToUse
aVeryLongType: AVeryLongTypeThatYouNeedToUse,
aSecondVeryLongType: AVeryLongTypeThatYouNeedToUse,
aThirdVeryLongType: AVeryLongTypeThatYouNeedToUse)
=
aVeryLongType aSecondVeryLongType aThirdVeryLongType
Expand All @@ -1078,8 +1078,8 @@ let ``long type member with return type should have parameters on separate lines
|> should equal """
type C () =
member __.LongMethodWithLotsOfParameters(
aVeryLongType: AVeryLongTypeThatYouNeedToUse
aSecondVeryLongType: AVeryLongTypeThatYouNeedToUse
aVeryLongType: AVeryLongTypeThatYouNeedToUse,
aSecondVeryLongType: AVeryLongTypeThatYouNeedToUse,
aThirdVeryLongType: AVeryLongTypeThatYouNeedToUse)
: int
=
Expand All @@ -1094,8 +1094,8 @@ let ``long constructors should have parameters on separate lines`` () =
|> prepend newline
|> should equal """
type C (
aVeryLongType: AVeryLongTypeThatYouNeedToUse
aSecondVeryLongType: AVeryLongTypeThatYouNeedToUse
aVeryLongType: AVeryLongTypeThatYouNeedToUse,
aSecondVeryLongType: AVeryLongTypeThatYouNeedToUse,
aThirdVeryLongType: AVeryLongTypeThatYouNeedToUse)
=
member this.X = 42
Expand Down
4 changes: 2 additions & 2 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2524,7 +2524,7 @@ and genMemberDefn astContext node =
let ctorPats =
expressionFitsOnRestOfLine
(col sepComma (simplePats ps) (genSimplePat astContext))
(indent +> sepNln +> col sepNln (simplePats ps) (genSimplePat astContext) +> unindent)
(indent +> sepNln +> col (sepComma +> sepNln) (simplePats ps) (genSimplePat astContext) +> unindent)

// In implicit constructor, attributes should come even before access qualifiers
ifElse ats.IsEmpty sepNone (sepSpace +> genOnelinerAttributes astContext ats)
Expand Down Expand Up @@ -2686,7 +2686,7 @@ and genPat astContext pat =
| PatTuple ps ->
expressionFitsOnRestOfLine
(col sepComma ps (genPat astContext))
(indent +> sepNln +> col sepNln ps (genPat astContext))
(indent +> sepNln +> col (sepComma +> sepNln) ps (genPat astContext))
| PatStructTuple ps ->
!- "struct " +> sepOpenT +> atCurrentColumn (colAutoNlnSkip0 sepComma ps (genPat astContext)) +> sepCloseT
| PatSeq(PatList, ps) ->
Expand Down

0 comments on commit 4c8aeb8

Please sign in to comment.