OCamlFormat 0.29.0
We're happy to announce the release of OCamlFormat 0.29.0.
CHANGES:
Highlight
-
* Support OCaml 5.5 syntax (#2772, #2774, #2775, #2777, #2780, #2781, #2782, #2783, @Julow) The update brings several tiny changes, they are listed below.
-
* Update Odoc's parser to 3.0 (#2757, @Julow) The indentation of code-blocks containing OCaml code is reduced by 2 to avoid changing the generated documentation. The indentation within code-blocks is now significative in Odoc and shows up in generated documentation.
Added
-
Added option
letop-punning(#2746, @WardBrian) to control whether punning is used in extended binding operators. For example, the codelet+ x = x in ...can be formatted aslet+ x in ...whenletop-punning=always. Withletop-punning=never, it becomeslet+ x = x in .... The default ispreserve, which will only use punning when it exists in the source. This also applies tolet%extbindings (#2747, @WardBrian). -
Support the unnamed functor parameters syntax in module types (#2755, #2759, @Julow)
module type F = ARG -> SThe following lines are now formatted as they are in the source file:
module M : (_ : S) -> (_ : S) -> S = N module M : S -> S -> S = N (* The preceding two lines are no longer turned into this: *) module M : (_ : S) (_ : S) -> S = N
Fixed
-
Fix dropped comment in
(function _ -> x (* cmt *))(#2739, @Julow) -
*
cases-matching-exp-indent=compactdoes not impactbegin endnodes that don't have a match inside. (#2742, @EmileTrotignon)(* before *) begin match () with | () -> begin f x end end (* after *) begin match () with | () -> begin f x end end -
Ast_mappernow iterates on all locations inside of Longident.t, instead of only some. (#2737, @v-gb) -
Remove line break in
M with module N = N (* cmt *)(#2779, @Julow)
Internal
- Added information on writing tests to
CONTRIBUTING.md(#2838, @WardBrian)
Changed
-
indentation of the
endkeyword in a match-case is now always at least 2. (#2742, @EmileTrotignon)(* before *) begin match () with | () -> begin match () with | () -> () end end (* after *) begin match () with | () -> begin match () with | () -> () -
* use shortcut
begin endinmatchcases andif then elsebody. (#2744, @EmileTrotignon)(* before *) match () with | () -> begin match () with | () -> end end (* after *) match () with | () -> begin match () with | () -> end end -
* Set the
ocaml-versionto5.4by default (#2750, @EmileTrotignon) The main difference is that theeffectkeyword is recognized without having to addocaml-version=5.3to the configuration. In exchange, code that useeffectas an identifier must useocaml-version=5.2. -
The work to support OCaml 5.5 come with several improvements:
- Improve the indentation of
let structure-itemwith the[@ocamlformat "disable"]attribute.let structure-itemmeanslet module,let open,let includeandlet exception. (let open M in e)[@a]is turned intolet[@a] open M in e.- Long
let open ... inno longer exceed the margin. - Improve indentation of
let structure-itemwithin parentheses:(* before *) (let module M = M in M.foo) (* after *) (let module M = M in M.foo)
- Improve the indentation of