Skip to content

Stroustrup style leads to half indent in match expression when returning List/Array #2586

@panmona

Description

@panmona

Issue created from fantomas-online

Code

let y x =
    match x with
    | Case1
    | Case2 -> [ "X" ]
    | Case3 -> [ "Y" ]

Result

let y x =
    match x with
    | Case1
      | Case2 -> [ "X" ]
    | Case3 -> [ "Y" ]

Problem description

From my understanding, the Stroustrup style shouldn't have an influence on the match expression brackets.

I would in this case expect no half indent on the | Case2.

This only seems to occur when the right side of the match is either an array or a list expression.

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 main branch at 2022-10-14T16:59:37Z - 35f093c

    { config with
                MultilineBlockBracketsOnSameColumn = true
                ExperimentalStroustrupStyle = true }

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions