On behalf of the development team, I’d like to announce the release of ocamlformat version 0.15.0 .
Here are the main highlights of this release:
Support for OCaml 4.11
This means both that it compiles and runs using this version, but also that it can format 4.11-specific language features (quoted extensions: {%foo|...|}
).
Compatibility with base and stdio v0.14.0
This compatibility has been restored since ocamlformat-0.14.3 but wasn’t publicly announced, ocamlformat is now compatible from base v0.12.0 to v0.14.0 included.
Bugfixes
Many bugs and unoptimal formatting were also fixed in this release:
- Do not break inline elements such as
{i blah}
in docstrings - Distinguish hash-getter from hash-comparison infix operators. Operators of the form
#**#
or#**.
where**
can be 0 or more operator chars are considered getter operators and are not surrounded by spaces, as opposed to regular infix operators - Type constraint on return type of functions is now always printed before the function body
- Restore previous functionality for pre-post extension points
- Fix extra break before
function
body of afun
Indent further args of anonymous functions - Do not clear the emacs
*compilation*
buffer on successful reformat - Fix disabling with attributes on OCaml < 4.08
- Preserve unwrapped comments by not adding artificial breaks when
wrap-comments=false
andocp-indent-compat=true
are set to avoid interfering with ocp-indent indentation - Break long literal strings at the margin
- Break after a multiline argument in an argument list
- Remove unnecessary parens around object
- Fix placement of comments on constants
- Do not escape arguments of some Odoc tags. The characters
[]{}
must not be escaped in the arguments of@raise
,@author
,@version
and others. - Fix missing open line between multi-line let-binding with poly-typexpr
- Remove trailing space after expression when followed by an attribute and break before attributes attached to multi-line phrases
- Do not add a space to minimal comments
(* *)
,(** *)
and(*$ *)
- Fix attributes position in labelled arguments type
- Add missing parens around type annotation in anonymous function
- Fix alignment of ‘then’ keyword in parenthesised expression
- Recognise eliom file extensions
A note for new users
We encourage you to try ocamlformat, that can be installed from opam directly ( opam install ocamlformat
), but please remember that it is still beta software. We added a FAQ for new users that should help you decide if ocamlformat is the right choice for you.