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

Sufficiently indent match case bodies for other indentation lengths than 4 #502

Closed
cmeeren opened this issue Oct 10, 2019 · 0 comments
Closed

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Oct 10, 2019

The following is my own style when using 2-space indentation. Note that I indent the case bodies extra to push them past the expressions I match on.

match x with
| Some y ->
    let z = 1
    Some (y + z)
| None -> None

The following is Fantomas with 2-space indentation:

match x with
| Some y ->
  let z = 1
  Some(y + z)
| None -> None

I suggest that Fantomas makes sure to indent the case bodies past the match expressions (e.g. by indenting relative to the start of the case match expression instead of the pipe symbol).

Fantomas already does something similar for lambda bodies:

let a =
  b
  |> List.map (fun (c, h) ->
       let x = 2
       x)

Note how the body is indented relative to List.map, not the pipe symbol.

jindraivanek added a commit to jindraivanek/fantomas that referenced this issue Oct 12, 2019
jindraivanek added a commit that referenced this issue Oct 14, 2019
Fix for #502: Sufficiently indent match case bodies for other indentation lengths than 4
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