Skip to content

Commit

Permalink
Don't add duplicate newline between letbindings inside type definition.
Browse files Browse the repository at this point in the history
Fixes #709. (#714)
  • Loading branch information
nojaf authored Mar 6, 2020
1 parent 052673d commit 37eb222
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Fantomas.Tests/TypeDeclarationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,4 +1000,34 @@ and [<Marker>] Room =
{ Details: Details
Items: Item list
Exits: Exits }
"""

[<Test>]
let ``trivia newlines between letbinding of type, 709`` () =
formatSourceString false """
open Xunit
open FSharp.Core
open Swensen.Unquote
type FormattingSpecs() =
[<Fact>]
let ``true is true``() = test <@ true = true @>
[<Fact>]
let ``false is false``() = test <@ false = false @>
""" config
|> prepend newline
|> should equal """
open Xunit
open FSharp.Core
open Swensen.Unquote
type FormattingSpecs() =
[<Fact>]
let ``true is true``() = test <@ true = true @>
[<Fact>]
let ``false is false``() = test <@ false = false @>
"""
1 change: 1 addition & 0 deletions src/Fantomas/SourceParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1310,4 +1310,5 @@ let getRangesFromAttributesFromSynMemberDefinition (mdn: SynMemberDefn) =
match mdn with
| SynMemberDefn.Member(mb,_) -> getRangesFromAttributesFromSynBinding mb
| SynMemberDefn.AbstractSlot(valSig, _, _) -> getRangesFromAttributesFromSynValSig valSig
| SynMemberDefn.LetBindings(lb::_,_,_,_) -> getRangesFromAttributesFromSynBinding lb
| _ -> []

0 comments on commit 37eb222

Please sign in to comment.