Releases: ocaml-ppx/ocamlformat
0.23.0
CHANGES:
Removed
Bug fixes
- Preserve comments around object open/close flag (#2097, @trefis, @gpetiot)
- Preserve comments around private/mutable/virtual keywords (#2098, @trefis, @gpetiot)
- Closing parentheses of local open now comply with
indicate-multiline-delimiters(#2116, @gpetiot) - emacs: fix byte-compile warnings (#2119, @syohex)
Changes
0.22.4
CHANGES:
Removed
- Profiles
compactandsparseare now removed (#2075, @gpetiot) - Options
align-cases,align-constructors-declandalign-variants-declare now removed (#2076, @gpetiot) - Option
disable-outside-detected-projectis now removed (#2077, @gpetiot)
Deprecated
Bug fixes
- emacs: Remove temp files in the event of an error (#2003, @gpetiot)
- Fix unstable comment formatting around prefix op (#2046, @gpetiot)
Changes
- Qtest comments are not re-formatted (#2034, @gpetiot)
- ocamlformat-rpc is now distributed through the ocamlformat package (#2035, @Julow)
- Doc-comments code blocks with a language other than 'ocaml' (set in metadata) are not parsed as OCaml (#2037, @gpetiot)
- More comprehensible error message in case of version mismatch (#2042, @gpetiot)
- The global configuration file (
$XDG_CONFIG_HOMEor$HOME/.config) is only applied when no project is detected,--enable-outside-detected-projectis set, and no applicable.ocamlformatfile has been found. Global and local configurations are no longer used at the same time. (#2039, @gpetiot) - Set
ocaml-versionto a fixed version (4.04.0) by default to avoid reproducibility issues and surprising behaviours (#2064, @kit-ty-kate) - Split option
--numeric=X-Yinto--range=X-Yand--numeric(flag). For now--rangecan only be used with--numeric. (#2073, #2082, @gpetiot)
New features
- New syntax
(*= ... *)for verbatim comments (#2028, @gpetiot) - Preserve the begin-end construction in the AST (#1785, @hhugo, @gpetiot)
- Preserve position of comments located after the semi-colon of the last element of lists/arrays/records (#2032, @gpetiot)
- Option
--print-configdisplays a warning when an .ocamlformat file defines redundant options (already defined by a profile) (#2084, @gpetiot)
0.22.3
CHANGES:
Removed
- Profiles
compactandsparseare now removed (#2075, @gpetiot) - Options
align-cases,align-constructors-declandalign-variants-declare now removed (#2076, @gpetiot) - Option
disable-outside-detected-projectis now removed (#2077, @gpetiot)
Deprecated
Bug fixes
- emacs: Remove temp files in the event of an error (#2003, @gpetiot)
- Fix unstable comment formatting around prefix op (#2046, @gpetiot)
Changes
- Qtest comments are not re-formatted (#2034, @gpetiot)
- ocamlformat-rpc is now distributed through the ocamlformat package (#2035, @Julow)
- Doc-comments code blocks with a language other than 'ocaml' (set in metadata) are not parsed as OCaml (#2037, @gpetiot)
- More comprehensible error message in case of version mismatch (#2042, @gpetiot)
- The global configuration file (
$XDG_CONFIG_HOMEor$HOME/.config) is only applied when no project is detected,--enable-outside-detected-projectis set, and no applicable.ocamlformatfile has been found. Global and local configurations are no longer used at the same time. (#2039, @gpetiot) - Set
ocaml-versionto a fixed version (4.04.0) by default to avoid reproducibility issues and surprising behaviours (#2064, @kit-ty-kate) - Split option
--numeric=X-Yinto--range=X-Yand--numeric(flag). For now--rangecan only be used with--numeric. (#2073, #2082, @gpetiot)
New features
- New syntax
(*= ... *)for verbatim comments (#2028, @gpetiot) - Preserve the begin-end construction in the AST (#1785, @hhugo, @gpetiot)
- Preserve position of comments located after the semi-colon of the last element of lists/arrays/records (#2032, @gpetiot)
- Option
--print-configdisplays a warning when an .ocamlformat file defines redundant options (already defined by a profile) (#2084, @gpetiot)
0.22.2
CHANGES:
Removed
- Profiles
compactandsparseare now removed (#2075, @gpetiot) - Options
align-cases,align-constructors-declandalign-variants-declare now removed (#2076, @gpetiot) - Option
disable-outside-detected-projectis now removed (#2077, @gpetiot)
Deprecated
Bug fixes
- emacs: Remove temp files in the event of an error (#2003, @gpetiot)
- Fix unstable comment formatting around prefix op (#2046, @gpetiot)
Changes
- Qtest comments are not re-formatted (#2034, @gpetiot)
- ocamlformat-rpc is now distributed through the ocamlformat package (#2035, @Julow)
- Doc-comments code blocks with a language other than 'ocaml' (set in metadata) are not parsed as OCaml (#2037, @gpetiot)
- More comprehensible error message in case of version mismatch (#2042, @gpetiot)
- The global configuration file (
$XDG_CONFIG_HOMEor$HOME/.config) is only applied when no project is detected,--enable-outside-detected-projectis set, and no applicable.ocamlformatfile has been found. Global and local configurations are no longer used at the same time. (#2039, @gpetiot) - Set
ocaml-versionto a fixed version (4.04.0) by default to avoid reproducibility issues and surprising behaviours (#2064, @kit-ty-kate) - Split option
--numeric=X-Yinto--range=X-Yand--numeric(flag). For now--rangecan only be used with--numeric. (#2073, #2082, @gpetiot)
New features
- New syntax
(*= ... *)for verbatim comments (#2028, @gpetiot) - Preserve the begin-end construction in the AST (#1785, @hhugo, @gpetiot)
- Preserve position of comments located after the semi-colon of the last element of lists/arrays/records (#2032, @gpetiot)
- Option
--print-configdisplays a warning when an .ocamlformat file defines redundant options (already defined by a profile) (#2084, @gpetiot)
0.21.0
CHANGES:
Bug fixes
-
Add missing parentheses around variant class arguments (#1967, @gpetiot)
-
Fix position of
:=whenassignment-operator=end-line(#1985, @gpetiot) -
Fix position of comments attached to constructor decl (#1986, @gpetiot)
-
Do not wrap docstrings,
wrap-commentsshould only impact non-documentation comments, wrapping invalid docstrings would cause the whole file to not be formatted (#1988, @gpetiot) -
Do not break between 2 module items when the first one has a comment attached on the same line. Only a comment on the next line should induce a break to make it clear to which element it is attached to (#1989, @gpetiot)
-
Preserve position of comments attached to the last node of a subtree (#1667, @gpetiot)
-
Do not override the values of the following non-formatting options when a profile is set:
comment-check,disable,max-iters,ocaml-version, andquiet(#1995, @gpetiot). -
Remove incorrect parentheses around polymorphic type constraint (#2002, @gpetiot)
-
Handle cases where an attribute is added to a bind expression, e.g.
(x >>= (fun () -> ())) [@a](#2013, @emillon) -
Fix indentation of constraints of a package type pattern (#2025, @gpetiot)
Changes
-
More expressions are considered "simple" (not inducing a break e.g. as an argument of an application):
-
Print odoc code block delimiters on their own line (#1980, @gpetiot)
-
Make formatting of cons-list patterns consistent with cons-list expressions, (::) operators are aligned when possible, comments position also improved (#1983, @gpetiot)
-
Apply 'sequence-style' to add a space before ';;' between toplevel items, consistently with the formatting of ';' in sequences (#2004, @gpetiot)
New features
- Format toplevel phrases and their output (#1941, @Julow, @gpetiot).
This feature is enabled with the flag--parse-toplevel-phrases.
Toplevel phrases are supported when they are located in doc-comments blocks and cinaps comments.
Whole input files can also be formatted as toplevel phrases with the flag--repl-file.
RPC
-
ocamlformat-rpc-lib is now functorized over the IO (#1975, @gpetiot).
Now handlesCsexp.ttypes instead ofSexplib0.Sexp.t. -
RPC v2 (#1935, @panglesd):
Define a 'Format' command parameterized with optionnal arguments to set or override the config and path, to format in the style of a file. -
Prevent RPC to crash on version mismatch with
.ocamlformat(#2011, @panglesd, @Julow)
0.20.1
0.20.0
CHANGES:
Deprecated
-
Profiles
compactandsparseare now deprecated and will be removed by version 1.0 (#1803, @gpetiot) -
Options that are not set by the preset profiles are now deprecated and will be removed by version 1.0:
align-cases,align-constructors-declandalign-variants-decl(#1793, @gpetiot)disambiguate-non-breaking-match(#1805, @gpetiot)break-before-in(#1888, @gpetiot)break-cases={toplevel,all}(#1890, @gpetiot)break-collection-expressions(#1891, @gpetiot)break-fun-decl=smart(#1892, @gpetiot)break-fun-sig=smart(#1893, @gpetiot)break-string-literals(#1894, @gpetiot)break-struct(#1895, @gpetiot)extension-indent(#1896, @gpetiot)function-indent(#1897, @gpetiot)function-indent-nested(#1898, @gpetiot)if-then-else={fit-or-vertical,k-r}(#1899, @gpetiot)indicate-multiline-delimiters=closing-on-separate-line(#1900, @gpetiot)indent-after-in(#1901, @gpetiot)let-binding-indent(#1902, @gpetiot)let-binding-spacing=sparse(#1903, @gpetiot)match-indent(#1904, @gpetiot)match-indent-nested(#1905, @gpetiot)module-item-spacing=preserve(#1906, @gpetiot)nested-match(#1907, @gpetiot)parens-tuple-patterns(#1908, @gpetiot)sequence-style=before(#1909, @gpetiot)stritem-extension-indent(#1910, @gpetiot)type-decl-indent(#1911, @gpetiot)
Bug fixes
-
Fix normalization of sequences of expressions (#1731, @gpetiot)
-
Type constrained patterns are now always parenthesized, parentheses were missing in a class context (#1734, @gpetiot)
-
Support sugared form of coercions in let bindings (#1739, @gpetiot)
-
Add missing parentheses around constructor used as indexing op (#1740, @gpetiot)
-
Avoid normalizing newlines inside quoted strings
{|...|}(#1754, @nojb, @hhugo) -
Fix quadratic behavior when certain constructs are nested. This corresponds
to the cases where a partial layout is triggered to determine if a construct
fits on a single line for example. (#1750, #1766, @emillon) -
Fix non stabilizing comments after infix operators (
*,%,#-ops) (#1776, @gpetiot) -
Fix excessive break and wrong indentation after a short-open when
indicate-multiline-delimiters=closing-on-separate-line(#1786, @gpetiot) -
Add parentheses around type alias used as type constraint (#1801, @gpetiot)
-
Fix alignment of comments inside a tuple pattern and remove incorrect linebreak.
Fix formatting of labelled arguments containing comments.
(#1797, @gpetiot) -
Emacs: only hook ocamlformat mode on tuareg/caml modes when ocamlformat is not disabled (#1814, @gpetiot)
-
Fix boxing of labelled arguments, avoid having a linebreak after a label when the argument has a comment attached (#1830, #1885, @gpetiot)
-
Add missing parentheses around application of prefix op when applied to other operands (#1825, @gpetiot)
-
Fix application of a monadic binding when 'break-infix-before-func=false' (#1849, @gpetiot)
-
Fix dropped comments attached to a sequence in a sugared extension node (#1853, @gpetiot)
-
Fix formatting of exception types, and add missing parentheses (#1873, @gpetiot)
-
Preserve sugared syntax of extension points with attributes (#1913, @gpetiot)
-
Improve comment attachment when followed but not preceded by a linebreak (#1926, @gpetiot)
-
Fix position of comments preceding Pmod_ident (#1939, @gpetiot)
-
Make the formatting of attributes and docstrings more consistent (#1929, @gpetiot)
-
Fix stabilization of comments inside attributes (#1942, @gpetiot)
Changes
-
Set 'module-item-spacing=compact' in the default/conventional profile (#1848, @gpetiot)
-
Preserve bracketed lists in the Parsetree (#1694, #1876, #1914, @gpetiot)
-
Line directives now cause OCamlFormat to emit an error, they were previously silently ignored (#1845, @gpetiot)
-
Apply option 'module-item-spacing' on mutually recursive type declarations for more consistency (#1854, @gpetiot)
New features
-
Handle punned labelled arguments with type constraint in function applications.
For example, function application of the formfoo ~(x:int)instead of the explicitfoo ~x:(x:int). (ocaml#10434) (#1756, #1759, @gpetiot)
This syntax is only produced when the output syntax is at least OCaml 4.14. -
Allow explicit binders for type variables (ocaml#10437) (#1757, @gpetiot)
-
Add a new
ocaml-versionoption to select the version of OCaml syntax of the output (#1759, @gpetiot) -
Allow disambiguated global identifiers (like t/2) so they can be formatted by tools like OCaml-LSP (#1716, @let-def)
-
Handle let operator punning uniformly with other punning forms.
Normalizes let operator to the punned form where possible, if output syntax version is at least OCaml 4.13.0. (#1834, #1846, @jberdine) -
Remove unnecessary surrounding parentheses for immediate objects.
This syntax is only produced when the output syntax is at least OCaml 4.14. (#1934, @gpetiot)
0.19.0
CHANGES:
Bug fixes
-
Fix formatting of odoc tags: the argument should be on the same line, indent description that wraps (#1634, #1635, @gpetiot)
-
Consistently format let bindings and monadic let bindings, do not drop comments before monadic bindings (#1636, @gpetiot)
-
Fix dropped comments attached to pattern constrained by polynewtype (#1645, @gpetiot)
-
Add missing spaces inside begin-end delimiting an ite branch (#1646, @gpetiot)
-
Add missing parens around function at RHS of infix op (#1642, @gpetiot)
-
Preserve begin-end keywords delimiting match cases (#1651, @gpetiot)
-
Fix alignment of closing paren on separate line for anonymous functions (#1649, @gpetiot)
-
Preserve begin-end keywords around infix operators (#1652, @gpetiot)
-
Preserve
begin%extsyntax for infix opererator expressions (#1653, @gpetiot) -
Consistently format comments attached to let-and bindings located at toplevel (#1663, @gpetiot)
-
Remove double parens around a functor in a module application (#1681, @gpetiot)
-
Improve breaking of comments to avoid violating the margin (#1676, @jberdine)
-
Fix parentheses around successive unary operations (#1696, @gpetiot)
-
Add missing break between pattern and attribute (#1711, @gpetiot)
-
Add missing parentheses around expression having attributes or comments inside a shorthand let-open clause (#1708, @gpetiot)
-
Do not consider leading star '*' when checking the diff of doc comments (#1712, @hhugo)
-
Fix formatting of multiline non-wrapping comments (#1723, @gpetiot)
Changes
-
Improve the diff of unstable docstrings displayed in error messages (#1654, @gpetiot)
-
Use UTF8 length of strings, not only in wrapped comments (#1673, @jberdine)
-
Depend on
odoc-parserinstead ofodoc(#1683, #1713, @kit-ty-kate, @jonludlam, @Julow)
The parser from odoc has been split from the main odoc package and put into its own package,odoc-parser. -
Revert infix-form list formatting to pre-0.17.0 (#1717, @gpetiot)
New features
-
Implement OCaml 4.13 features
-
Emacs integration (disabled for ocamlformat < 0.19.0):
-
Add 'line-endings=lf|crlf' option to specify the line endings used in the
formatted output. (#1703, @nojb)
Internal
- A script
tools/build-mingw64.shis provided to build a native Windows
binary ofocamlformatusingmingw64toolchain under Cygwin.
0.18.0
CHANGES:
Bug fixes
-
Fix extraneous parenthesis after
let openwithclosing-on-separate-line(#1612, @Julow) -
Add missing break between polytype quantification and arrow-type body (#1615, @gpetiot)
Changes
-
Use dune instrumentation backend for
bisect_ppx(#1550, @tmattio) -
Format objects and classes consistently with structure and signature items (#1569, @bikallem)
New features
0.17.0
CHANGES:
Removed
-
Remove the 'let-open' option, deprecated since 0.16.0 (#1563, @gpetiot)
-
Remove support for OCaml 4.06 and 4.07, minimal version requirement bumped to OCaml 4.08 (#1549, @gpetiot)
-
Remove the 'extension-sugar' option, deprecated since 0.14.0 (#1588, @gpetiot)
Bug fixes
-
Fix parsing of invalid file wrt original source handling (#1542, @hhugo)
-
Preserve the syntax of infix set/get operators (#1528, @gpetiot)
String.getand similar calls used to be automatically rewritten to their corresponding infix form.(), that was incorrect when using the-unsafecompilation flag. Now the concrete syntax of these calls is preserved. -
Add location of invalid docstring in warning messages (#1529, @gpetiot)
-
Fix comments on the same line as prev and next elements (#1556, @gpetiot)
-
Break or-patterns after comments and preserve their position at the end of line (#1555, @gpetiot)
-
Fix linebreak between signature items of the same group (#1560, @gpetiot)
-
Fix stack overflow on large string constants (#1562, @gpetiot)
-
Fix comment position around list cons operator (#1567, @gpetiot)
-
Fix the vertical alignment test to break down comment groups (#1575, @gpetiot)
Changes
-
Add buffer filename in the logs when applying ocamlformat (#1557, @dannywillems)
-
Improve comment position in pattern collection (#1576, @gpetiot)
-
Consistent positioning of lambda return type annotations when no-break-infix-before-func and pre/post extensions (#1581, @gpetiot)