Ocamlformat 0.14.1 match-indent broken?

I have match-indent set to 2 in my .ocamlformat I would expect the | to be indented to the right but the results I’m getting are below. Is this a bug or am I not understanding match-indent?

let f x =
  match x with
  | 1 -> 2
  | 3 -> 4
1 Like

This looks like a bug with match-indent-nested=never (which is set by default). It’s thrown off by the surrounding context being a function.

(* With --match-indent=2 *)

let f =
  match x___________________ with
    | a__________________________ -> b____________________________
    | c__________________________ -> d____________________________

let f y =
  match x____________________ with
  | a__________________________ -> b____________________________
  | c__________________________ -> d____________________________

You may wish to set match-indent-nested=always, which avoids this bug.

1 Like

That works, thank you.