fsprojects / fantomas

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

Unmatched '{' error when formatting the code #3017

Closed MangelMaxime closed 6 months ago

MangelMaxime commented 6 months ago

Issue created from fantomas-online

Code


let FableSampleExpected :Changelogs = {
    Unreleased = Some {
        ChangelogData.Default with
            Fixed =
                normalizeNewline
                    """#### Python
"""
    }
    Releases = [
        Some {
            ChangelogData.Default with
                Changed =
                    normalizeNewline ""
        }
    ]
}

Result

let FableSampleExpected: Changelogs =
    { Unreleased =
        Some
            { ChangelogData.Default with
                Fixed =
                    normalizeNewline
                        """#### Python
""" }
      Releases =
        [ Some
              { ChangelogData.Default with
                  Changed = normalizeNewline "" } ] }

Problem description

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

Extra information

Options

Fantomas main branch at 2023-12-13T08:46:10Z - 2e2e9e009cb1281c4a92549170304d8a97d5f80b

Default Fantomas configuration

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.

MangelMaxime commented 6 months ago

The problem is coming from the line """ } indenting the } makes the error go away, I am not sure why.

https://github.com/fsprojects/fantomas/assets/4760796/d865558f-3673-486b-b900-d50b5d599e15

nojaf commented 6 months ago

Thanks, this rings a bell.