fantomas icon indicating copy to clipboard operation
fantomas copied to clipboard

MultiLineLambdaClosingNewline + ExperimentalStroustrupStyle is not displaying very well for some use cases

Open albertwoo opened this issue 3 years ago • 3 comments

Issue created from fantomas-online

Code

MudButton'() {
    style { displayInlineBlock }
    Disabled isLoading
    OnClick(fun _ -> task {
        setIsLoading true
        do! hook.DownloadTransactionReports()
        setIsLoading false
    })
    i18n.tran "Common.BtnDownload"
}

Result

MudButton'() {
    style { displayInlineBlock }
    Disabled isLoading
    OnClick(fun _ -> task {
        setIsLoading true
        do! hook.DownloadTransactionReports()
        setIsLoading false
    }
    )
    i18n.tran "Common.BtnDownload"
}

Expected

Can we put

}
)

into one line ?

Problem description

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

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 master branch at 2022-07-19T14:35:52Z - 0fe6785076e045f28e4c88e6a57dd09b649ce671

    { config with
                MultiLineLambdaClosingNewline = true
                BlankLinesAroundNestedMultilineExpressions = false
                ExperimentalStroustrupStyle = true }

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

albertwoo avatar Jul 20 '22 10:07 albertwoo

Hello, on paper this sounds reasonable.

However, a lot will depend on the implementation. I would accept a PR if it can be solved in an elegant way. If there is too much church to get this right, this would be an acceptable limitation.

Are you interested in submitting a proposal PR?

nojaf avatar Jul 20 '22 11:07 nojaf

Sorry, it maybe too complex to me.

albertwoo avatar Jul 20 '22 11:07 albertwoo

Please elaborate on what might be too complex for you. We are working on a new documentation initiative https://github.com/fsprojects/fantomas/issues/2315 and hope to encourage people to contribute. A lack of knowledge of this project nor the F# language should not be a bottleneck. I'm curious to find out what is too complex about this or why you immediately assume this.

nojaf avatar Jul 20 '22 12:07 nojaf