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

Idempotency problem when match is follow by pipe #1532

Closed
1 of 3 tasks
nojaf opened this issue Mar 22, 2021 · 2 comments
Closed
1 of 3 tasks

Idempotency problem when match is follow by pipe #1532

nojaf opened this issue Mar 22, 2021 · 2 comments

Comments

@nojaf
Copy link
Contributor

nojaf commented Mar 22, 2021

Issue created from fantomas-online

Formatted code

match x with
| Foo f -> []
| Bar x ->
  "\n"
  + columnHeadersText
  + "\n"
  + seprator
  + "\n"
  + itemsText
|> Some

Reformatted code

match x with
| Foo f -> []
| Bar x ->
  "\n"
  + columnHeadersText
  + "\n"
  + seprator
  + "\n"
  + itemsText
  |> Some

Problem description

Fantomas was not able to produce the same code after reformatting the result.
The recent change to fix #1501 introduced this problem.
The body of the last clause needs to be further away from the infix that follows.

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 Master at 03/21/2021 11:39:41 - f79dfe5

    { config with
                IndentSize = 2 }

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

@nojaf
Copy link
Contributor Author

nojaf commented Mar 22, 2021

Can happen with 4 spaces indent as well:

match x with
| Foo f -> 
            "\n"
            + columnHeadersText
            + "\n"
            + seprator
            + "\n"
            + itemsText
| Bar x -> 
    // comment
    []
|||> Some

@nojaf
Copy link
Contributor Author

nojaf commented Mar 22, 2021

Apply same fix as #1327

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

No branches or pull requests

1 participant