Releases: ocaml-mlx/ocamlformat-mlx
0.28.1.2
0.28.1.1
CHANGES:
Highlight
- * Update Odoc's parser to 3.0 (ocaml-ppx#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(ocaml-ppx#2746, @WardBrian) to control whether
punning is used in extended binding operators.
For example, the codelet+ x = x in ...can be formatted as
let+ 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 (ocaml-ppx#2747, @WardBrian). -
Support the unnamed functor parameters syntax in module types
(ocaml-ppx#2755, ocaml-ppx#2759, @Julow)module type F = ARG -> S
The 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 *))(ocaml-ppx#2739, @Julow) -
*
cases-matching-exp-indent=compactdoes not impactbegin endnodes that
don't have a match inside. (ocaml-ppx#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.
(ocaml-ppx#2737, @v-gb)
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. (ocaml-ppx#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. (ocaml-ppx#2744, @EmileTrotignon)(* before *) match () with | () -> begin match () with | () -> end end (* after *) match () with | () -> begin match () with | () -> end end
-
* Set the
ocaml-versionto5.4by default (ocaml-ppx#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 use
ocaml-version=5.2.
0.27.0.1
CHANGES:
- relax OCaml constraints, compatible with OCaml 5.3
0.27.0
CHANGES:
Highlight
-
* Support OCaml 5.2 syntax (ocaml-ppx#2519, ocaml-ppx#2544, ocaml-ppx#2590, ocaml-ppx#2596, ocaml-ppx#2621, ocaml-ppx#2628, @Julow, @EmileTrotignon, @hhugo)
This includes local open in types, raw identifiers, and the new
representation for functions.
This might change the formatting of some functions due to the formatting code
being completely rewritten. -
Support OCaml 5.3 syntax (ocaml-ppx#2609, ocaml-ppx#2610, ocaml-ppx#2611, ocaml-ppx#2622, ocaml-ppx#2623, ocaml-ppx#2562, ocaml-ppx#2624, ocaml-ppx#2625, ocaml-ppx#2627, @Julow, @Zeta611)
This adds support for effect patterns, short functor type arguments and utf8
identifiers.
To format code using the neweffectsyntax, add this option to your
.ocamlformat:ocaml-version = 5.3 -
Documentation comments are now formatted by default (ocaml-ppx#2390, @Julow)
Use the optionparse-docstrings = falseto restore the previous behavior. -
* Consistent indentation of polymorphic variant arguments (ocaml-ppx#2427, @Julow)
Increases the indentation by one to make the formatting consistent with
normal variants. For example:... (* before *) (`Msg (foo bar)) (* after *) (`Msg (foo bar)) -
Build on OCaml 5.3 (ocaml-ppx#2603, @adamchol, @Julow)
Added
-
Improve the emacs plugin (ocaml-ppx#2577, ocaml-ppx#2600, @gridbugs, @thibautbenjamin)
Allow a custom command to be used to run ocamlformat and add compatibility
with emacs ocaml tree-sitter modes. -
Added option
let-binding-deindent-fun(ocaml-ppx#2521, @henrytill)
to control the indentation of thefunin:let f = fun foo -> bar -
Added back the flag
--disable-outside-detected-project(ocaml-ppx#2439, @gpetiot)
It was removed in version 0.22. -
Support newer Odoc syntax (ocaml-ppx#2631, ocaml-ppx#2632, ocaml-ppx#2633, @Julow)
Changed
-
* Consistent formatting of comments (ocaml-ppx#2371, ocaml-ppx#2550, @Julow)
This is mostly an internal change but some comments might be formatted differently. -
* Improve formatting of type constraints with type variables (ocaml-ppx#2437, @gpetiot)
For example:let f : type a b c. a -> b -> c = ... -
* Improve formatting of functor arguments (ocaml-ppx#2505, @Julow)
This also reduce the indentation of functor arguments with long signatures. -
Improvements to the Janestreet profile (ocaml-ppx#2445, ocaml-ppx#2314, ocaml-ppx#2460, ocaml-ppx#2593, ocaml-ppx#2612, @Julow, @tdelvecchio-jsc)
-
* Undo let-bindings and methods normalizations (ocaml-ppx#2523, ocaml-ppx#2529, @gpetiot)
This remove the rewriting of some forms of let-bindings and methods:let f x = (x : int)is no longer rewritten intolet f x : int = xlet f (type a) (type b) ...is no longer rewritten intolet f (type a b) ...let f = fun x -> ...is no longer rewritten intolet f x = ...
-
* The
break-colonoption is now taken into account for method type constraints (ocaml-ppx#2529, @gpetiot) -
* Force a break around comments following an infix operator (fix non-stabilizing comments) (ocaml-ppx#2478, @gpetiot)
This adds a line break:a || (* this comment is now on its own line *) b
Fixed
-
Fix placement of comments in some cases (ocaml-ppx#2471, ocaml-ppx#2503, ocaml-ppx#2506, ocaml-ppx#2540, ocaml-ppx#2541, ocaml-ppx#2592, ocaml-ppx#2617, @gpetiot, @Julow)
Some comments were being moved or causing OCamlformat to crash.
OCamlformat refuses to format if a comment would be missing in its output, to avoid loosing code. -
Fix attributes being dropped or moved (ocaml-ppx#2247, ocaml-ppx#2459, ocaml-ppx#2551, ocaml-ppx#2564, ocaml-ppx#2602, @EmileTrotignon, @tdelvecchio-jsc, @Julow)
OCamlformat refuses to format if the formatted code has a different meaning than the original code, for example, if an attribute is removed.
We also try to avoid moving attributes even if that doesn't change the original code, for example we no longer formatopen[@attr] Masopen M [@@attr]. -
Remove trailing space inside a wrapping empty signature (ocaml-ppx#2443, @Julow)
-
Fix extension-point spacing in structures (ocaml-ppx#2450, @Julow)
-
* Consistent break after string constant argument (ocaml-ppx#2453, @Julow)
-
* Fix cinaps comment formatting to not change multiline string contents (ocaml-ppx#2463, @tdelvecchio-jsc)
-
* Fix the indentation of tuples in attributes and extensions (ocaml-ppx#2488, @Julow)
-
* Fix weird indentation and line breaks after comments (ocaml-ppx#2507, ocaml-ppx#2589, ocaml-ppx#2606, @Julow)
-
* Fix unwanted alignment in if-then-else (ocaml-ppx#2511, @Julow)
-
Fix missing parentheses around constraint expressions with attributes (ocaml-ppx#2513, @alanechang)
-
Fix formatting of type vars in GADT constructors (ocaml-ppx#2518, @Julow)
-
Fix
[@ocamlformat "disable"]in some cases (ocaml-ppx#2242, ocaml-ppx#2525, @EmileTrotignon)
This caused a bug insideclass typeconstructs and when attached to alet ... in -
Display
a##binstead ofa ## band similarly for operators that start with # (ocaml-ppx#2580, @v-gb) -
* Fix arrow type indentation with
break-separators=before(ocaml-ppx#2598, @Julow) -
Fix missing parentheses around a let in class expressions (ocaml-ppx#2599, @Julow)
-
Fix formatting of paragraphs in lists in documentation (ocaml-ppx#2607, @Julow)
-
Avoid unwanted space in references and links text in documentation (ocaml-ppx#2608, @Julow)
-
* Improve the indentation of attributes in patterns (ocaml-ppx#2613, @Julow)
-
* Avoid large indentation in patterns after
let%ext(ocaml-ppx#2615, @Julow)
0.6
0.2
Add jsx prop punning
0.1
Preview release