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

Regression of #502: Pattern match bodies no longer indented sufficiently for shorter indentation sizes #1886

Closed
3 tasks
cmeeren opened this issue Sep 10, 2021 · 2 comments

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Sep 10, 2021

Issue created from fantomas-online

Expected result

match x with
| "1" ->
    longLineLongLineLongLineLongLineLongLineLongLineLongLineLongLineLongLine
| "2" ->
    longLineLongLineLongLineLongLineLongLineLongLineLongLineLongLineLongLine

Actual result

match x with
| "1" ->
  longLineLongLineLongLineLongLineLongLineLongLineLongLineLongLineLongLine
| "2" ->
  longLineLongLineLongLineLongLineLongLineLongLineLongLineLongLineLongLine

Problem description

There has been a regression where pattern matching bodies are no longer indented sufficiently for shorter indentation sizes (e.g. 2 spaces). This was originally implemented/fixed in #502. I don't know when the regression happened.

The extra indentation is useful for better separation of patterns vs. the "body" of each pattern. The problem does not exist for 4-space indentation.

Extra information

  • 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 4.6 branch at 09/08/2021 16:41:29 - 9bf6601

    { config with
                IndentSize = 2
                MaxLineLength = 80 }
@nojaf
Copy link
Contributor

nojaf commented Sep 10, 2021

This was updated in #1501 to align with the style guide.
The codebase also benefitted from this correction.

@nojaf nojaf closed this as completed Sep 10, 2021
@cmeeren
Copy link
Contributor Author

cmeeren commented Sep 12, 2021

Ah, I thought the style guide covered this. I have created dotnet/docs#26071 to try and rectify this, so we 2-space-indenters can get sufficient visual separation between the clauses and the bodies. 🙂

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

No branches or pull requests

2 participants