fsprojects / fantomas

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

Regression: An empty line or comment at the end of a list breaks Stroustrup formatting #3079

Closed Linschlager closed 2 months ago

Linschlager commented 2 months ago

Issue created from fantomas-online

Code

let array = [|
    someItem

|]

let array2 = [|
    someItem
    // comment
|]

Result

let array =
    [|
        someItem

    |]

let array2 =
    [|
        someItem
    // comment
    |]

Problem description

Placing an empty line or comment on the last line of an arrow, list or similar breaks Stroustrup formatting

Extra information

Might be related to one of the following:


Options

Fantomas main branch at 15/4/2024

    { config with
                MultilineBracketStyle = stroustrup }

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

Hi, thank you for this report. This may have been introduced by https://github.com/fsprojects/fantomas/pull/3071. Are you interested in submitting a PR for this?

Linschlager commented 2 months ago

@nojaf Here you go https://github.com/fsprojects/fantomas/pull/3080