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

Preserve comments after record #516

Closed
nojaf opened this issue Oct 17, 2019 · 1 comment · Fixed by #828
Closed

Preserve comments after record #516

nojaf opened this issue Oct 17, 2019 · 1 comment · Fixed by #828

Comments

@nojaf
Copy link
Contributor

nojaf commented Oct 17, 2019

Issue created from fantomas-ui

There should a newline before the block comment.

Code

module TriviaModule =

let env = "DEBUG"

type Config = {
    Name: string
    Level: int
}

let meh = { // this comment right
    Name = "FOO"; Level = 78 }

(* ending with block comment *)

Result

module TriviaModule =

    let env = "DEBUG"

    type Config =
        { Name: string
          Level: int }

    let meh =
        { // this comment right
          Name = "FOO"
          Level = 78 }
    (* ending with block comment *)

Options

Fantomas 3.0.0

Name Value
IndentOnTryWith false
IndentSpaceNum 4
KeepNewlineAfter false
PageWidth 120
ReorderOpenDeclaration false
SemicolonAtEndOfLine false
SpaceAfterComma true
SpaceAfterSemicolon true
SpaceAroundDelimiter true
SpaceBeforeArgument true
SpaceBeforeColon false
StrictMode false
@nojaf
Copy link
Contributor Author

nojaf commented Oct 17, 2019

[<Test>]
let ``meh`` () =
    formatSourceString false """module TriviaModule =

let env = "DEBUG"

type Config = {
    Name: string
    Level: int
}

let meh = { // this comment right
    Name = "FOO"; Level = 78 }

(* ending with block comment *)
"""  config
    |> prepend newline
    |> should equal """
module TriviaModule =

    let env = "DEBUG"

    type Config =
        { Name: string
          Level: int }

    let meh =
        { // this comment right
          Name = "FOO"
          Level = 78 }

    (* ending with block comment *)
"""

@nojaf nojaf changed the title Bug report from fantomas-ui Preserve comments after recors Apr 18, 2020
@nojaf nojaf changed the title Preserve comments after recors Preserve comments after record Apr 18, 2020
nojaf added a commit to nojaf/fantomas that referenced this issue May 15, 2020
nojaf added a commit that referenced this issue May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant