Skip to content

Commit

Permalink
Print trivia after closing multi line record brace. Fixes #1124. (#1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf authored Sep 9, 2020
1 parent 8b958bf commit 7cb0382
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Fantomas.Tests/RecordTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,3 +1027,19 @@ let person =
Address = { Street = "Bakerstreet"; Number = 42 } // end address
} // end person
"""

[<Test>]
let ``comment after closing brace of multi-line record type, 1124`` () =
formatSourceString false """
module Test =
type t =
{ long_enough : string
also_long_enough : string } // Hi I am a comment
""" config
|> prepend newline
|> should equal """
module Test =
type t =
{ long_enough: string
also_long_enough: string } // Hi I am a comment
"""
1 change: 1 addition & 0 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3224,6 +3224,7 @@ and genMultilineSimpleRecordTypeDefn tdr ms ao' fs astContext =
(leaveLeftBrace tdr.Range
+> col sepSemiNln fs (genField astContext ""))
+> sepCloseS
+> leaveNodeTokenByName tdr.Range RBRACE
+> onlyIf (List.isNotEmpty ms) sepNln
+> sepNlnBetweenTypeAndMembers ms
+> genMemberDefnList
Expand Down

0 comments on commit 7cb0382

Please sign in to comment.