Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comma at EOL for member/ctor tuples #843

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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