[ANN] OCamlformat 0.14.0

Hello,

As described in this thread, ocamlformat 0.14.0 introduced a new algorithm to determine how
documentation comments are placed. We underestimated the impact of making this the default, and this means that many unwanted diffs were present for 0.13.0 -> 0.14.0 upgrades.

We are going to prepare a 0.14.1 release next week reverting this behavior back to the 0.13.0 defaults. Users still on 0.13.0 are encouraged to wait for this and upgrade directly to 0.14.1.

Sorry for the inconvenience, and thanks for the feedback!

2 Likes

Yes, that’s a good point. Bottom line is that spacing between items is not super consistent at the moment (see Feature request: Simpler spacing heuristics for modules · Issue #1253 · ocaml-ppx/ocamlformat · GitHub for a recent example), so we’d like to improve that area. If we can find simple rule that works, that’s even better!

1 Like

Personally I do (at least between 0 or 1). I can’t imagine LaTeX choosing how to gather my sentences into paragraphs or splitting each of my paragraphs into one sentences paragraphs.

In module implementation I very often group one-liner definitions according to their relatedness. ocamlformat insisting on putting a space between these one-liners is one of the reasons among others I’m not using it, it worsens legibility by lack of compactness.

Basically the rule I would like is: after a one-liner definition don’t do anything special except collapsing blank lines to a single one if there is more than one following.

2 Likes

As Etienne mentioned, we have released OCamlformat 0.14.1, reverting the change to the defaults and our plans to deprecate the doc-comments option.

For projects that already upgraded to 0.14.0 (eg. Coq), the doc-comments option will change its meaning again. It is necessary to add doc-comments=before to have the documentation comments placed before.
Moreover, the new option doc-comments-val added in 0.14.0 has a higher precedence than doc-comments, even when it’s not set. It is thus necessary to set them both to before to have the old “before” behavior.
This will be improved in the next release (see https://github.com/ocaml-ppx/ocamlformat/pull/1340).

Thank you to our early adopters to bear with us. We are improving our release process to reduce confusion for the next updates. As usual, if you have any feedback, please open an issue on https://github.com/ocaml-ppx/ocamlformat to discuss it with us.

2 Likes