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

Long .Setup line in Moq code results in broken indentation #1662

Closed
2 tasks
asik opened this issue Apr 19, 2021 · 1 comment · Fixed by #1663
Closed
2 tasks

Long .Setup line in Moq code results in broken indentation #1662

asik opened this issue Apr 19, 2021 · 1 comment · Fixed by #1663

Comments

@asik
Copy link

asik commented Apr 19, 2021

Issue created from fantomas-online

Code

type Class() =
    member this.``kk``() =
        async {
            mock
                .Setup(fun m ->
                m.CreateBlah
                    (It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Id>(), It.IsAny<uint32>()))
                .Returns(Some mock)
                .End
        }
        |> Async.StartImmediate

Result

type Class() =
    member this.kk() =
        async {
            mock.Setup
                (fun m -> m.CreateBlah(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Id>(), It.IsAny<uint32>()))
                .Returns(
                Some mock
            )
                .End
        }
        |> Async.StartImmediate

Problem description

The resulting code is not valid F#.

Note this code uses Moq. The .End property is an in-house extension property that does the same as |> ignore. Indeed, replacing it with |> ignore is a workaround here as fantomas generates valid code then.

This started happening with fantomas 4.4. Fixing this would really help us as it happens in about a million files.

Extra information

  • [x ] 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 04/17/2021 11:23:36 - 26674f9

Default Fantomas configuration

@asik asik changed the title <Insert meaningful title> Long .Setup line in Moq code results in broken indentation Apr 19, 2021
nojaf added a commit to nojaf/fantomas that referenced this issue Apr 20, 2021
@nojaf
Copy link
Contributor

nojaf commented Apr 20, 2021

Hello Andre, thank you for reporting this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants