fantomas icon indicating copy to clipboard operation
fantomas copied to clipboard

Lambda with MultiLineLambdaClosingNewline is split weirdly

Open nojaf opened this issue 2 years ago • 0 comments

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 - 3a939e97128291b396a47c2b65e6a738fb9019a0

    { 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?

nojaf avatar Oct 04 '22 06:10 nojaf