Releases: ocaml-ppx/ocamlformat
0.16.0
CHANGES:
Removed
-
Remove the 'escape-chars' option, deprecated since 0.14.0 (#1462, @gpetiot)
-
Remove the 'escape-strings' option, deprecated since 0.14.0 (#1463, @gpetiot)
-
Remove the 'doc-comments-val' option, deprecated since 0.14.2 (#1461, @gpetiot)
-
Removed options are now listed in the commandline manual (new REMOVED OPTIONS section) (#1469, @Julow)
Changes
-
Set 'indicate-multiline-delimiters=no' on default profile (#1452, @gpetiot)
-
Option 'let-open' is now deprecated, concrete syntax will always be preserved starting from OCamlFormat v0.17.0, corresponding to the current 'let-open=preserve' behavior. (#1467, @gpetiot)
-
Warnings printed by ocamlformat itself now use the 4.12 style with symbolic names (#1511, #1518, @emillon)
-
Remove extension from executable name in error messages. On Windows, this means that messages now start with "ocamlformat: ..." instead of "ocamlformat.exe: ..." (#1531, @emillon)
-
Using tokens instead of string manipulation when inspecting the original source (#1526, #1533, #1541 @hhugo) (#1532, @gpetiot)
Bug fixes
-
Allow a break after
if%extwithif-then-else=keyword-first(#1419, #1543, @gpetiot) -
Fix parentheses around infix applications having attributes (#1464, @gpetiot)
-
Fix parentheses around the index arg of a non-sugared index operation (#1465, @gpetiot)
-
Preserve comment position around
matchandtrykeywords (#1458, @gpetiot) -
Indent attributes attached to included modules better (#1468, @gpetiot)
-
Clean up
ocamlformat.elfor submission to MELPA (#1476, #1495, @bcc32) -
Add missing parentheses around a pattern matching that is the left-hand part of a sequence when an attribute is attached (#1483, @gpetiot)
-
Add missing parentheses around infix operator used to build a function (#1486, @gpetiot)
-
Fix invalid fragment delimiters of format-invalid-files recovery mode (#1485, @hhugo)
-
Fix misalignment of cases in docked
functionmatch (#1498, @gpetiot) -
Preserve short-form extensions for structure item extensions (#1502, @gpetiot)
For exampleopen%ext Mwill not get rewritten to[%%ext open M]. -
Do not change the spaces within the code spans in docstrings (#1499, @gpetiot)
-
Comments of type constrained label in record pattern have to be relocated in 4.12 (#1517, @gpetiot)
-
Fix inconsistencies of the closing parentheses with indicate-multiline-delimiters (#1377, #1540, @gpetiot)
-
Fix position of comments around list constructor (::) (#1524, @gpetiot)
-
Fix formatting of field override with constraint (#1544, @gpetiot)
New features
0.15.1
0.15.0
CHANGES:
Changes
-
Do not break inline elements such as
{i blah}in docstrings (#1346, @jberdine) -
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 (#1376, @gpetiot) -
Type constraint on return type of functions is now always printed before the function body (#1381, #1397, @gpetiot)
Bug fixes
-
Restore previous functionality for pre-post extension points (#1342, @jberdine)
-
Fix extra break before
functionbody of afun(#1343, @jberdine)
Indent further args of anonymous functions (#1440, @gpetiot) -
Do not clear the emacs
*compilation*buffer on successful reformat (#1350, @jberdine) -
Fix disabling with attributes on OCaml < 4.08 (#1322, @emillon)
-
Preserve unwrapped comments by not adding artificial breaks when
wrap-comments=falseandocp-indent-compat=trueare set to avoid interfering with ocp-indent indentation. (#1352, @gpetiot) -
Break after a multiline argument in an argument list (#1360, @gpetiot)
-
Do not escape arguments of some Odoc tags (#1391, 1408, @gpetiot, @Julow)
The characters[]{}must not be escaped in the arguments of@raise,@author,@versionand others. -
Fix missing open line between multi-line let-binding with poly-typexpr (#1372, @jberdine)
-
Remove trailing space after expression when followed by an attribute and break before attributes attached to multi-line phrases (#1382, @gpetiot)
-
Do not add a space to minimal comments
(* *),(** *)and(*$ *)(#1407, @gpetiot) -
Fix attributes position in labelled arguments type (#1434, @gpetiot)
-
Add missing parens around type annotation in anonymous function (#1433, @gpetiot)
-
Fix alignment of 'then' keyword in parenthesised expression (#1421, @gpetiot)
New features
0.14.3
0.14.2
CHANGES:
Changes
-
Merge
doc-comments-valoption withdoc-comments. The placement of documentation comments onvalandexternalitems is now controled bydoc-comments.doc-comments=afterbecomesdoc-comments=after-when-possibleto take into account the technical limitations of ocamlformat;doc-comments=beforeis unchanged;doc-comments-valis now replaced withdoc-comments
To reproduce the former behaviorsdoc-comments=before+doc-comments-val=before: now usedoc-comments=before;doc-comments=before+doc-comments-val=after: now usedoc-comments=before-except-val;doc-comments=after+doc-comments-val=before: this behavior did not make much sense and is not available anymore;doc-comments=after+doc-comments-val=after: now usedoc-comments=after-when-possible.
(#1358) (Josh Berdine, Jules Aguillon, Guillaume Petiot)
This reverts changes introduced in 0.14.1 (#1335) and 0.14.0 (#1012).
0.14.1
0.14.0
CHANGES:
New features
-
Add an option
--format-invalid-filesto print unparsable parts of the input as verbatim text. This feature is still experimental. (#1026) (Guillaume Petiot) -
Support multi-indices extended indexing operators (#1279, #1277) (Jules Aguillon, Guillaume Petiot)
This feature has been added in OCaml 4.10.0 -
Handle OCaml 4.10.0 AST (#1276) (Guillaume Petiot)
-
Preserve functor syntax for consistency (#1312) (Guillaume Petiot)
Previously both functor syntax:module M = functor (K : S) -> struct endandmodule M (K : S) = struct endwould be formatted as the latter, the original syntax is now preserved.
Changes
-
Add the option
doc-comments-val=before|after(#1012) (Jules Aguillon)
This option set the placement of documentation comment onvalandexternalonly.
It is set toafterby default. -
The default for
doc-commentsis changed fromaftertobefore(#1012, #1325) (Jules Aguillon)
This affects bothconventional(default) andocamlformatprofiles. -
Some options are now deprecated:
doc-comments(#1293, #1012)
This option depends on a flawed heuristic.
It is replaced bydoc-comments-valforvalandexternaldeclarations.
There is no equivalent to this option in the general case.escape-chars,escape-stringsandextension-sugar(#1293)
These options are rarely used and their default behavior is considered to be the right behavior.
-
Add space between
row_fieldattributes and the label or arguments, to be
consistent with the non-polymorphic case. (#1299) (Craig Ferguson)
Bug fixes
-
Fix missing parentheses around
let open(#1229) (Jules Aguillon)
eg.M.f (M.(x) [@attr])would be formatted toM.f M.(x) [@attr], which would crash OCamlformat -
Remove unecessary parentheses with attributes in some structure items:
-
Fix some bugs related to comments:
-
Fix formatting of empty signature payload
[%a:](#1236) (Etienne Millon) -
Fix parenthesizing when accessing field of construct application (#1247) (Guillaume Petiot)
-
Fix formatting of attributes on object overrides
{< >}(#1238) (Etienne
Millon) -
Fix attributes on coercion (#1239) (Etienne Millon)
-
Fix formatting of attributes on packed modules (#1243) (Etienne Millon)
-
Fix parens around binop operations with attributes (#1252, #1306) (Guillaume Petiot, Craig Ferguson)
-
Remove unecessary parentheses in the argument of indexing operators (#1280) (Jules Aguillon)
-
Retain attributes on various AST nodes:
-
Avoid unnecessary spacing after object types inside records and polymorphic variants,
e.g.{foo : < .. > [@a]}and{ foo : < .. > }(#1296) (Craig Ferguson) -
Fix missing parentheses around tuples with attributes. (#1301) (Craig Ferguson)
Previously,f ((0, 0) [@a])would be formatted tof (0, 0) [@a], crashing OCamlformat. -
Avoid emitting
>]when an object type is contained in an extension point
or attribute payload (#1298) (Craig Ferguson) -
Fix crash on the expression
(0).*(0)(#1304) (Jules Aguillon)
It was formatting to0.*(0)which parses as an other expression. -
Preserve empty doc-comments syntax. (#1311) (Guillaume Petiot)
Previously(**)would be formatted to(***). -
Do not crash when a comment contains just a newline (#1290) (Etienne Millon)
-
Handle lazy patterns as arguments to
class(#1289) (Etienne Millon) -
Preserve cinaps comments containing unparsable code (#1303) (Jules Aguillon)
Previously, OCamlformat would fallback to the "wrapping" logic, making the comment
unreadable and crashing in some cases. -
Fix normalization of attributes, fixing the docstrings in attributes (#1314) (Guillaume Petiot)
-
Add missing parentheses around OR-patterns with attributes (#1317) (Guillaume Petiot)
-
Fix spacing inside parens for symbols when the spacing was handled by the englobing exp (#1316) (Guillaume Petiot)
-
Fix invalid (unparsable) docstrings (#1315) (Guillaume Petiot)
When parsing a comment raises an error in odoc, it is printed as-is. -
Fix parenthesizing of optional arguments rebound to non-variables, e.g.
let f ?a:(A) = ()rather than the unparsablelet f ?a:A = ()(#1305) (Craig Ferguson)
0.13.0
CHANGES:
New features
- Add an option
--margin-checkto emit a warning if the formatted output exceeds the margin (#1110) (Guillaume Petiot) - Preserve comment indentation when
wrap-commentsis unset (#1138, #1159) (Jules Aguillon) - Improve error messages (#1147) (Jules Aguillon)
- Display standard output in the emacs plugin even when ocamlformat does not fail (#1189) (Guillaume Petiot)
Removed
- Remove
ocamlformat_reason(#254, #1185) (Etienne Millon).
This tool has never been released to opam, has no known users, and overlaps
with whatrefmtcan do. - Remove
ocamlformat-diff(#1205) (Guillaume Petiot)
This tool has never been released to opam, has no known users, and overlaps
with whatmerge-fmtcan do.
Packaging
- Work with base v0.13.0 (#1163) (Jules Aguillon)
Bug fixes
- Fix placement of comments just before a '|' (#1203) (Jules Aguillon)
- Fix build version detection when building in the absence of a git root (#1198) (Anil Madhavapeddy)
- Fix wrapping of or-patterns in presence of comments with
break-cases=fit(#1167) (Jules Aguillon)
This also fixes an unstable comment bug in or-patterns - Fix an unstable comment bug in variant declarations (#1108) (Jules Aguillon)
- Fix: break multiline comments (#1122) (Guillaume Petiot)
- Fix: types on named arguments were wrapped incorrectly when preceding comments (#1124) (Guillaume Petiot)
- Fix the indentation produced by max-indent (#1118) (Guillaume Petiot)
- Fix break after Psig_include depending on presence of docstring (#1125) (Guillaume Petiot)
- Remove some calls to if_newline and break_unless_newline and fix break before closing brackets (#1168) (Guillaume Petiot)
- Fix unstable cmt in or-pattern (#1173) (Guillaume Petiot)
- Fix location of comment attached to the underscore of an open record (#1208) (Guillaume Petiot)
- Fix parentheses around optional module parameter (#1212) (Christian Barcenas)
- Fix grouping of horizontally aligned comments (#1209) (Guillaume Petiot)
- Fix dropped comments around module pack expressions (#1214) (Jules Aguillon)
- Fix regression of comment position in list patterns (#1141) (Josh Berdine)
- Fix: adjust definition of Location.is_single_line to reflect margin (#1102) (Josh Berdine)
Documentation
0.12
CHANGES:
Changes
- Set "conventional" as the default profile (#1060) (Guillaume Petiot)
This new profile is made to better match the most used style and is encouraged.
To continue using the previous default, useprofile = ocamlformatin your.ocamlformat. - CLI: Allow both values of boolean options (#1062) (Jules Aguillon)
Now, both--optand --no-opt` are available on the CLI for any boolean option "opt".
Previously, only one of them were available depending on the default value. - Auto mode for
break-string-literals(#1057) (Guillaume Petiot)
wrap,newlinesandnewlines-and-wrapvalues ofbreak-string-literalsare removed.
autoreplaces them, it is equivalent tonewlines-and-wrap. - Dock collection brackets (#1014) (Guillaume Petiot)
after-and-dockedvalue ofbreak-separatorsis removed and is replaced by a newdock-collection-bracketsoption. - Preserve
beginandendkeywords in if-then-else (#978) (Jules Aguillon)
Previously,begin/endkeywords around if-then-else branches were turned into parentheses.
New features
- Give a hint when warning 50 is raised (#1111) (Guillaume Petiot)
- Add a message when a config value is removed (#1089) (Etienne Millon)
Explain what replaces removed options and avoid printing a parsing error. - Implement
sequence-blank-line=preserve-onefor let bindings (#1077) (Jules Aguillon)
Preserve a blank line afterlet .. inwhensequence-blank-lineset topreserve-one.
Previously, only blank lines after;could be preserved. - Parse toplevel directives (#1020) (Jules Aguillon)
Allow#directivesin.mlfiles.
Previously, files containing a directive needed to be parsed as "use file".
The "use file" mode is removed and--use-fileis now the same as--impl. - Don't require
--name, require kind, forbid--inplace, allow--check, make--enable-outside-detected-projectimplicit when reading from stdin (#1018) (Guillaume Petiot) - Parse code in docstrings (#941) (Guillaume Petiot)
Format OCaml code in cinaps-style comments(*$ code *)and code blocks in documentation comments(** {[ code ]} *). - Parse documentation comments with Odoc (#721) (Jules Aguillon)
Formatting of documentation comments is more robust and support newer Odoc syntaxes.
Internally, Odoc replaces Octavius as the documentation parser.
Bug fixes
- Fix unstabilizing comments on assignments (#1093) (Guillaume Petiot)
- Fix the default value documentation for
max-indent(#1105) (Guillaume Petiot) - Fix closing parenthesis exceeding the margin in function application (#1098) (Jules Aguillon)
- Missing break before attributes of
Pmty_with(#1103) (Josh Berdine) - Fix closing quote exceeding the margin (#1096) (Jules Aguillon)
- Fix break before the closing bracket of collections (exceeding the margin) (#1073) (Guillaume Petiot)
- Fix precedence of Dot wrt Hash (#1058) (Guillaume Petiot)
- Fix break in variant type definition to not exceed the margin (#1064) (Guillaume Petiot)
- Fix newlines and indentation in toplevel extension points (#1054) (Guillaume Petiot)
- Fix placement of doc comments around extensions (#1052) (Jules Aguillon)
- Inline extensions that do not break (#1050) (Guillaume Petiot)
- Add missing cut before attributes in type declarations (#1051) (Guillaume Petiot)
- Fix alignment of cases (#1046) (Guillaume Petiot)
- Fix blank line after comments at the end of lists (#1045) (Guillaume Petiot)
- Fix indexing operators precedence (#1039) (Jules Aguillon)
- Fix dropped comment after infix op (#1030) (Guillaume Petiot)
- No newline if the input is empty (#1031) (Guillaume Petiot)
- Fix unstable comments around attributes (#1029) (Guillaume Petiot)
- Fix extra blank line in sequence (#1021) (Jules Aguillon)
- Check functor arguments when computing placement of doc comments (#1013) (Jules Aguillon)
- Fix indentation of labelled args (#1006) (Guillaume Petiot)
- Fix linebreak between or-cases with comments when
break-cases=all(#1002) (Guillaume Petiot) - Fix unstable unattached doc comment in records (#998) (Jules Aguillon)
- Fix string literal changed (#995) (Jules Aguillon)
- Fix type variable (#996) (Jules Aguillon)
- Fix crash on extension sequence (#992) (Guillaume Petiot)
- Fix position of expressions regarding of comments in infix-op expressions (#986) (Guillaume Petiot)
- Escape special characters in external declaration (#988) (Jules Aguillon)
- Fix parens around constrained expr with attrs (#987) (Guillaume Petiot)
- Fix the margin, and correctly breaks comments (#957) (Guillaume Petiot)
- Fix formatting of custom indexing operators (#975) (Guillaume Petiot)
- Fix position of comments of labelled arrow types (#976) (Guillaume Petiot)
- No box around inline odoc styles (#971) (Guillaume Petiot)
- Fix boxing of collection expressions/patterns (#960) (Guillaume Petiot)
- Fix crash on record expr with pack fields (#963) (Jules Aguillon)
- Fix letop in subexpr (#956) (hhugo)
Internal
- Take file kind from --name when formatting stdin (#1119) (Jules Aguillon)
- Make Fmt.t abstract (#1109) (Jules Aguillon)
- Future-proof Fmt API in case Fmt.t goes abstract (#1106) (Etienne Millon)
- Future-proof
FmtAPI in caseFmt.tgoes abstract (#1106) (Etienne Millon) - Optional names for formatting boxes in debug output (#1083) (Guillaume Petiot)
- Check ocamlformat error codes in the testsuite (#1084) (Etienne Millon)
- Clean
Translation_unit(#1078) (Guillaume Petiot) - Use dune file generation in test/passing/dune (#1082) (Etienne Millon)
- CI: factorize tests and check reason build (#1079) (Guillaume Petiot)
- Use short form for action in src/dune (#1076) (Etienne Millon)
- Cleanup
sequence_blank_line(#1075) (Jules Aguillon) - CI: use a script travis-ci.sh to simplify .travis.yml (#1063) (Guillaume Petiot)
- Remove utility functions from
Fmt_ast(#1059) (Guillaume Petiot) - CI: use opam-2.0.5 in Travis (#1044) (Anton Kochkov)
- CI: check the build with OCaml 4.07.1 and 4.08.0 (#1036) (Jules Aguillon)
- Use the same sets of options for both branches by default in
test_branch.sh(#1033) (Guillaume Petiot) - Fix
test_branch.shand CI checking of CHANGES.md (#1032, #1034) (Jules Aguillon) - Fix flag of git-worktree in
test_branch.shandbisect.sh(#1027) (Guillaume Petiot) - Remove the
bisect_ppxdependency and clean theMakefile(#1005) (Jules Aguillon) - Use a
CHANGES.mdlog file again (#1023) (Guillaume Petiot) - Support OCaml 4.09.0 (add the odoc.1.4.2 dependency) (#1024) (Guillaume Petiot)
- Update labels of issue templates (#1017) (Guillaume Petiot)
- Update labels in
CONTRIBUTING.md(#1007) (Guillaume Petiot) - Allow to ignore invalid options (#984) (hhugo)
The--ignore-invalid-optionflag is added to ignore invalid options in.ocamlformatfiles. - Improve the documentation of
--doc-comments(#982) (Jules Aguillon) - Remove symbolic links and change naming convention of tests (#980) (Guillaume Petiot)
- Change the type of
fmt_code(#974) (Guillaume Petiot) - Simplify
Makefile(#973) (hhugo) - Dune should not be flagged as a build dep anymore (#954) (Guillaume Petiot)