Skip to content

MultiLineLambdaClosingNewline unnecessarily breaks parameter list #2862

Open
@cmeeren

Description

@cmeeren

Issue created from fantomas-online

Code

Target.create "Build" (fun ctx ->
    // code
    // here
    ())

Result

Target.create
    "Build"
    (fun ctx ->
        // code
        // here
        ()
    )

Problem description

The example above is straight out of the F# style guide, section Formatting lambdas.

I would have expected setting MultiLineLambdaClosingNewline to true would (as its name implies) only move the final parenthesis, like this:

Target.create "Build" (fun ctx ->
    // code
    // here
    ()
)

This compiles, and it would be in keeping with the style guide:

When a lambda expression is used as an argument in a multi-line expression, and is followed by other arguments, place the body of a lambda expression on a new line, indented by one level:

However, as seen above, Fantomas additionally breaks the parameter list.

Extra information

  • The formatted result breaks my code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.
    • Maybe, with some guidance (I don't know the Fantomas code base), though not for several weeks due to travels

Options

Fantomas main branch at 1/1/1990

    { config with
                MultiLineLambdaClosingNewline = true }

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions