fsprojects / fantomas

FSharp source code formatter
https://fsprojects.github.io/fantomas
Other
758 stars 189 forks source link

`SpaceBeforeUppercaseInvocation` corrupts underscore lambda invocation #3081

Closed xperiandri closed 2 months ago

xperiandri commented 2 months ago

Issue created from fantomas-online

Code

type LocationPath () =

    let path = ResizeArray<obj> ()

    member _.Add (floor : BuildingFloor) =
        let last = path |> Seq.map _.GetType() |> Seq.tryLast
        ()

Result

type LocationPath () =

    let path = ResizeArray<obj> ()

    member _.Add (floor : BuildingFloor) =
        let last = path |> Seq.map _.GetType () |> Seq.tryLast
        ()

Pay attention to _.GetType() became _.GetType () which is wrong

Problem description

Please describe here the Fantomas problem you encountered. Check out our Contribution Guidelines.

Extra information

Options

Fantomas 6.3.0

    { config with
                SpaceBeforeUppercaseInvocation = true
                SpaceBeforeClassConstructor = true
                SpaceBeforeMember = true
                SpaceBeforeColon = true
                SpaceBeforeSemicolon = true }

Did you know that you can ignore files when formatting by using a .fantomasignore file? PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.

nojaf commented 2 months ago

Duplicate of https://github.com/fsprojects/fantomas/issues/3050. Feel free to send a PR for this problem.