OCamlPro / ocp-indent

Indentation tool for OCaml, to be used from editors like Emacs and Vim.
http://www.typerex.org/ocp-indent.html
Other
200 stars 63 forks source link

params indentation, align_params and max_indent #198

Closed william3 closed 8 years ago

william3 commented 8 years ago

hello, using ocp-indent 1.5.1, I get this indentation :

(* align_params=never
   max_indent=2 *)
let _ =
  let total = foo a b c
      d e in
  let ...

However, I would have think that the following should happen :

(* align_params=never
   max_indent=2 *)

let _ =
  let total = foo a b c
    d e in
  let ...

this is not a big issue however

AltGr commented 8 years ago

The parameter max_indent only affects some cases (see the doc), and those don't include function application, which always adds base_indent. We try not to over-indent, while retaining, as much as possible, "correct" indentation whatever comes next in the code. And e.g.:

let _ =
  let x = f
    x;
    g y
  in
  x

doesn't feel "correct" because x and g are at the same level. So here is the reason.