Skip to content

Lambda with MultiLineLambdaClosingNewline is split weirdly #2553

Description

@nojaf

Issue created from fantomas-online

Code

module Foo =
    [<Test>]
    let bar () =
        let thing =
            Mock<Foo>()
                .Setup(fun aaaaaaaaaaaa -> <@ aaaaaaaaaaaa.Abcdefghijklmnopqrs "Food" "IsTastier" @>).Returns(false)
                .Create()
        ()

Result

module Foo =
    [<Test>]
    let bar () =
        let thing =
            Mock<Foo>()
                .Setup(fun aaaaaaaaaaaa -> <@ aaaaaaaaaaaa.Abcdefghijklmnopqrs "Food" "IsTastier" @>
                )
                .Returns(false)
                .Create()

        ()

Problem description

The max_line_length ends exactly at @>. Could we take the closing ) into account?
And have

.Setup(fun aaaaaaaaaaaa -> 
    <@ aaaaaaaaaaaa.Abcdefghijklmnopqrs "Food" "IsTastier" @>
)
.Returns(false)

instead?

//cc @Smaug123

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.

Options

Fantomas main branch at 2022-10-03T18:04:44Z - 3a939e9

    { config with
                MaxLineLength = 100
                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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions