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

Newline before set expression is lost. #1314

Closed
3 tasks
nojaf opened this issue Dec 22, 2020 · 0 comments · Fixed by #1316
Closed
3 tasks

Newline before set expression is lost. #1314

nojaf opened this issue Dec 22, 2020 · 0 comments · Fixed by #1316

Comments

@nojaf
Copy link
Contributor

nojaf commented Dec 22, 2020

Issue created from fantomas-online

Code

          match x with
          | NotificationEvent.Lint (file, warnings) ->
              let uri = Path.FilePathToUri file

              diagnosticCollections.AddOrUpdate((uri, "F# Linter"), [||], (fun _ _ -> [||]))
              |> ignore

              let fs =
                warnings
                |> List.choose
                     (fun w ->
                       w.Warning.Details.SuggestedFix
                       |> Option.bind
                            (fun f ->
                              let f = f.Force()
                              let range = fcsRangeToLsp w.Warning.Details.Range

                              f
                              |> Option.map (fun f -> range, { Range = range; NewText = f.ToText })))

              lintFixes.[uri] <- fs

Result

match x with
| NotificationEvent.Lint (file, warnings) ->
    let uri = Path.FilePathToUri file

    diagnosticCollections.AddOrUpdate(
      (uri, "F# Linter"),
      [||],
      (fun _ _ -> [||])
    )
    |> ignore

    let fs =
      warnings
      |> List.choose
           (fun w ->
             w.Warning.Details.SuggestedFix
             |> Option.bind
                  (fun f ->
                    let f = f.Force()
                    let range = fcsRangeToLsp w.Warning.Details.Range

                    f
                    |> Option.map
                         (fun f -> range, { Range = range; NewText = f.ToText })))
    lintFixes.[uri] <- fs

Problem description

Trivia before SynExpr.Set is not printed.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 12/22/2020 15:26:56 - aac3975

    { config with
                IndentSize = 2
                MaxLineLength = 80 }

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

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