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

commented params #199

Closed william3 closed 9 years ago

william3 commented 9 years ago

Hello, using ocp-indent 1.5.1, I get the following :

let _ =
  foo b
              (* c *) (d);

instead of

let _ =
  foo b
  (*c*) (d);

or even better :

let _ =
  foo b
    (*c*) (d);

This code may seems strange. Atually I have many more parameters, and inside () I get some basic operations like (a -. b)

AltGr commented 9 years ago

Ah, funny bug indeed. It seems that the comment is aligned to the following element (comments require look-ahead for indentation), so that you get e.g.:

let _ =
  foo b
    (* c *)
    (d);

but here the next elements counts the length of the comment, which makes the comment shift right by its own length.

Thanks for reporting!