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

a couple remaining problems with ocp-indent of cinaps code #302

Closed ceastlund closed 4 years ago

ceastlund commented 4 years ago

Using ocp-indent built from 03bb53f1a9db9e61b66e6674f995ec150619a68b, I get the following indentation:

(*$
     Stdio.printf "\
  \nlet _f = function\
  \n   | 0 -> 0\
  \n      | _ -> 1\
  \n"
*)
let _f = function
  | 0 -> 0
  | _ -> 1
         (*$*)

The Stdio.printf does not need to be indented that far. I'd be fine with it being under the $, for example. The lines of the string literal following it do not seem consistent with where it is indented.

And the final (*$*) should not be indented at all. It seems that (*$*) immediatelly following an expression is consistently indented farther than it needs to be.

AltGr commented 4 years ago

I can see three points here:

ceastlund commented 4 years ago

First point: I think the rule for (* {[ has the indentation it does because it's a double-nesting. (*$ is only one conceptual delimiter, so I'd hope for less indentation than (* {[. This one isn't critical but it'd be nice to decrease the indentation.

Second point: Got it, working as intended then.

Third point: Great, looking forward to the fix!

AltGr commented 4 years ago

1 and 3 should be fixed by 3ce84f2d009833883f908669a89a99c5274d01c3 :)