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

Indentation bug in version 1.7.0 #275

Closed iguerNL closed 5 years ago

iguerNL commented 5 years ago

AFAIK, indentation of let j = ... in the example below is not correct:

let g x =
  (x * x
     [@ocaml.ppwarning "TODO: blabla"])

let h = "I am well indented"

let i x =
  x * x
    [@ocaml.ppwarning "TODO: blabla"]

    let j = "I am NOT well indented"

I also noticed a change in the indentation of code inside a fun ... -> wrt version 1.6.1. I don't know if it is wanted:

let f =
  (* change with version 1.6.1: indentation of 'fun x' and 'x + 1' are
     now at the same level*)
  fun x ->
  x + 1
mbarbin commented 5 years ago

I have witnessed the second change as well while trying out 1.7.0. I'm interested to read about the follow up on that change. +subscribe.

change with version 1.6.1: indentation of 'fun x' and 'x + 1' are now at the same level.

AltGr commented 5 years ago

The first point seems like a regression, I'll look into it. Probably related to #277, and the changes in extension points handling.

The second point is wanted, as per the changelog:

* indent the same (1 step) after `let f = fun x ->` and `let f =\n  fun x ->`

Thanks for reporting

AltGr commented 5 years ago

The OCaml parser indeed has a weird behaviour on these cases, reported as https://caml.inria.fr/mantis/view.php?id=7916