-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[new release] ocamlformat-lib, ocamlformat and ocamlformat-rpc-lib (0.27.0) #26998
Open
Julow
wants to merge
1
commit into
ocaml:master
Choose a base branch
from
Julow:release-ocamlformat-0.27.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+176
−0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
I might have fixed this in ocaml-ppx/ocamlformat#2635. I'll redo the release |
Julow
force-pushed
the
release-ocamlformat-0.27.0
branch
from
November 29, 2024 15:18
c3f1c80
to
1bfe7e1
Compare
….27.0) CHANGES: ### Highlight - \* Support OCaml 5.2 syntax (ocaml-ppx/ocamlformat#2519, ocaml-ppx/ocamlformat#2544, ocaml-ppx/ocamlformat#2590, ocaml-ppx/ocamlformat#2596, ocaml-ppx/ocamlformat#2621, ocaml-ppx/ocamlformat#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/ocamlformat#2609, ocaml-ppx/ocamlformat#2610, ocaml-ppx/ocamlformat#2611, ocaml-ppx/ocamlformat#2622, ocaml-ppx/ocamlformat#2623, ocaml-ppx/ocamlformat#2562, ocaml-ppx/ocamlformat#2624, ocaml-ppx/ocamlformat#2625, ocaml-ppx/ocamlformat#2627, @Julow, @Zeta611) This adds support for effect patterns, short functor type arguments and utf8 identifiers. To format code using the new `effect` syntax, add this option to your `.ocamlformat`: ``` ocaml-version = 5.3 ``` - Documentation comments are now formatted by default (ocaml-ppx/ocamlformat#2390, @Julow) Use the option `parse-docstrings = false` to restore the previous behavior. - \* Consistent indentation of polymorphic variant arguments (ocaml-ppx/ocamlformat#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/ocamlformat#2603, @adamchol, @Julow) ### Added - Improve the emacs plugin (ocaml-ppx/ocamlformat#2577, ocaml-ppx/ocamlformat#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/ocamlformat#2521, @henrytill) to control the indentation of the `fun` in: ``` let f = fun foo -> bar ``` - Added back the flag `--disable-outside-detected-project` (ocaml-ppx/ocamlformat#2439, @gpetiot) It was removed in version 0.22. - Support newer Odoc syntax (ocaml-ppx/ocamlformat#2631, ocaml-ppx/ocamlformat#2632, ocaml-ppx/ocamlformat#2633, @Julow) ### Changed - \* Consistent formatting of comments (ocaml-ppx/ocamlformat#2371, ocaml-ppx/ocamlformat#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/ocamlformat#2437, @gpetiot) For example: ``` let f : type a b c. a -> b -> c = ... ``` - \* Improve formatting of functor arguments (ocaml-ppx/ocamlformat#2505, @Julow) This also reduce the indentation of functor arguments with long signatures. - Improvements to the Janestreet profile (ocaml-ppx/ocamlformat#2445, ocaml-ppx/ocamlformat#2314, ocaml-ppx/ocamlformat#2460, ocaml-ppx/ocamlformat#2593, ocaml-ppx/ocamlformat#2612, @Julow, @tdelvecchio-jsc) - \* Undo let-bindings and methods normalizations (ocaml-ppx/ocamlformat#2523, ocaml-ppx/ocamlformat#2529, @gpetiot) This remove the rewriting of some forms of let-bindings and methods: + `let f x = (x : int)` is no longer rewritten into `let f x : int = x` + `let f (type a) (type b) ...` is no longer rewritten into `let f (type a b) ...` + `let f = fun x -> ...` is no longer rewritten into `let f x = ...` - \* The `break-colon` option is now taken into account for method type constraints (ocaml-ppx/ocamlformat#2529, @gpetiot) - \* Force a break around comments following an infix operator (fix non-stabilizing comments) (ocaml-ppx/ocamlformat#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/ocamlformat#2471, ocaml-ppx/ocamlformat#2503, ocaml-ppx/ocamlformat#2506, ocaml-ppx/ocamlformat#2540, ocaml-ppx/ocamlformat#2541, ocaml-ppx/ocamlformat#2592, ocaml-ppx/ocamlformat#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/ocamlformat#2247, ocaml-ppx/ocamlformat#2459, ocaml-ppx/ocamlformat#2551, ocaml-ppx/ocamlformat#2564, ocaml-ppx/ocamlformat#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 format `open[@attr] M` as `open M [@@attr]`. - Remove trailing space inside a wrapping empty signature (ocaml-ppx/ocamlformat#2443, @Julow) - Fix extension-point spacing in structures (ocaml-ppx/ocamlformat#2450, @Julow) - \* Consistent break after string constant argument (ocaml-ppx/ocamlformat#2453, @Julow) - \* Fix cinaps comment formatting to not change multiline string contents (ocaml-ppx/ocamlformat#2463, @tdelvecchio-jsc) - \* Fix the indentation of tuples in attributes and extensions (ocaml-ppx/ocamlformat#2488, @Julow) - \* Fix weird indentation and line breaks after comments (ocaml-ppx/ocamlformat#2507, ocaml-ppx/ocamlformat#2589, ocaml-ppx/ocamlformat#2606, @Julow) - \* Fix unwanted alignment in if-then-else (ocaml-ppx/ocamlformat#2511, @Julow) - Fix missing parentheses around constraint expressions with attributes (ocaml-ppx/ocamlformat#2513, @alanechang) - Fix formatting of type vars in GADT constructors (ocaml-ppx/ocamlformat#2518, @Julow) - Fix `[@ocamlformat "disable"]` in some cases (ocaml-ppx/ocamlformat#2242, ocaml-ppx/ocamlformat#2525, @EmileTrotignon) This caused a bug inside `class type` constructs and when attached to a `let ... in` - Display `a##b` instead of `a ## b` and similarly for operators that start with # (ocaml-ppx/ocamlformat#2580, @v-gb) - \* Fix arrow type indentation with `break-separators=before` (ocaml-ppx/ocamlformat#2598, @Julow) - Fix missing parentheses around a let in class expressions (ocaml-ppx/ocamlformat#2599, @Julow) - Fix formatting of paragraphs in lists in documentation (ocaml-ppx/ocamlformat#2607, @Julow) - Avoid unwanted space in references and links text in documentation (ocaml-ppx/ocamlformat#2608, @Julow) - \* Improve the indentation of attributes in patterns (ocaml-ppx/ocamlformat#2613, @Julow) - \* Avoid large indentation in patterns after `let%ext` (ocaml-ppx/ocamlformat#2615, @Julow)
Julow
force-pushed
the
release-ocamlformat-0.27.0
branch
from
November 29, 2024 15:18
1bfe7e1
to
2791697
Compare
This particular problem seems fixed but now it fails on a 32 bit platform. Do you have an idea on how to debug that ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Auto-formatter for OCaml code
CHANGES:
Highlight
* Support OCaml 5.2 syntax (Support Ptyp_open from OCaml 5.2 ocaml-ppx/ocamlformat#2519, Backport Pexp_function from OCaml 5.2 ocaml-ppx/ocamlformat#2544, Fix 'function' indent in methods with no-wrap-fun-args ocaml-ppx/ocamlformat#2590, Represent 'let f _ = function' in the CST ocaml-ppx/ocamlformat#2596, Support 5.2 raw identifiers ocaml-ppx/ocamlformat#2621, Preserve line endings in delimited string literals ocaml-ppx/ocamlformat#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 (Backport 5.3 changes to Format_doc and Location ocaml-ppx/ocamlformat#2609, Backport 5.3 changes to Parsetree.constant ocaml-ppx/ocamlformat#2610, Backport 5.3 short functor type syntax ocaml-ppx/ocamlformat#2611, 5.3 support: Backport utf8 identifiers ocaml-ppx/ocamlformat#2622, 5.3 support: Versioned keywords ocaml-ppx/ocamlformat#2623, Support for OCaml 5.3 effect syntax ocaml-ppx/ocamlformat#2562, 5.3 support: Backport attributes on constant fix ocaml-ppx/ocamlformat#2624, Reduce diffs in vendored parsers ocaml-ppx/ocamlformat#2625, 5.3 support: Backport quoted strings lexer fix ocaml-ppx/ocamlformat#2627, @Julow, @Zeta611)
This adds support for effect patterns, short functor type arguments and utf8
identifiers.
To format code using the new
effect
syntax, add this option to your.ocamlformat
:Documentation comments are now formatted by default (Enable 'parse-docstrings' in the default profile ocaml-ppx/ocamlformat#2390, @Julow)
Use the option
parse-docstrings = false
to restore the previous behavior.* Consistent indentation of polymorphic variant arguments (Align variant arguments indentation inside parentheses ocaml-ppx/ocamlformat#2427, @Julow)
Increases the indentation by one to make the formatting consistent with
normal variants. For example:
Build on OCaml 5.3 (Build on OCaml 5.3 ocaml-ppx/ocamlformat#2603, @adamchol, @Julow)
Added
Improve the emacs plugin (Allow custom commands for running ocamlformat ocaml-ppx/ocamlformat#2577, Add compatibility with emacs ocaml tree-sitter modes ocaml-ppx/ocamlformat#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
(Expose let_binding_deindent_fun flag ocaml-ppx/ocamlformat#2521, @henrytill)to control the indentation of the
fun
in:Added back the flag
--disable-outside-detected-project
(Cleanup enable/disable-outside-detected-project options ocaml-ppx/ocamlformat#2439, @gpetiot)It was removed in version 0.22.
Support newer Odoc syntax (Update vendored odoc-parser to version 2.4 ocaml-ppx/ocamlformat#2631, Update vendored odoc-parser to master branch ocaml-ppx/ocamlformat#2632, odoc: Align light syntax tables ocaml-ppx/ocamlformat#2633, @Julow)
Changed
* Consistent formatting of comments (Refactor handling of comments ocaml-ppx/ocamlformat#2371, Fix doc-comments '*)' exceeding the margin ocaml-ppx/ocamlformat#2550, @Julow)
This is mostly an internal change but some comments might be formatted differently.
* Improve formatting of type constraints with type variables (Reduce the indentation of (polytype) type constraints ocaml-ppx/ocamlformat#2437, @gpetiot)
For example:
* Improve formatting of functor arguments (Don't align breaking module arguments ocaml-ppx/ocamlformat#2505, @Julow)
This also reduce the indentation of functor arguments with long signatures.
Improvements to the Janestreet profile (Remove incorrect
fmt_expression ~epi
mechanism ocaml-ppx/ocamlformat#2445, Improvements to ocp-indent-compat and the Janestreet profile ocaml-ppx/ocamlformat#2314, Janestreet profile: do not breakfun _ -> function
ocaml-ppx/ocamlformat#2460, Wrap short fun after a let with the janestreet profile ocaml-ppx/ocamlformat#2593, janestreet: Fix indent of comments in records ocaml-ppx/ocamlformat#2612, @Julow, @tdelvecchio-jsc)* Undo let-bindings and methods normalizations (Undo let-bindings normalizations, carry out the args to remove the sugaring ocaml-ppx/ocamlformat#2523, Simplify representation of class field values and methods ocaml-ppx/ocamlformat#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 = x
let 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-colon
option is now taken into account for method type constraints (Simplify representation of class field values and methods ocaml-ppx/ocamlformat#2529, @gpetiot)* Force a break around comments following an infix operator (fix non-stabilizing comments) (Break around comments following an infix operator ocaml-ppx/ocamlformat#2478, @gpetiot)
This adds a line break:
Fixed
Fix placement of comments in some cases (Use type function_param in Pexp_fun ocaml-ppx/ocamlformat#2471, Distinguish fun_param for expr/class, unify parsing of val/newtype fun_param ocaml-ppx/ocamlformat#2503, Fix unstable comment around docked functor arg ocaml-ppx/ocamlformat#2506, Fix comments around underscore in record patterns ocaml-ppx/ocamlformat#2540, Fix dropped comments before begin-end case ocaml-ppx/ocamlformat#2541, Un-indent comment after fun ocaml-ppx/ocamlformat#2592, Improve formatting of assignment operators with comments ocaml-ppx/ocamlformat#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 (Moves module attributes after the module keyword ocaml-ppx/ocamlformat#2247, Fixed bug with attributes on sub-expressions of infix operators. ocaml-ppx/ocamlformat#2459, Improve the placement of begin..end attributes ocaml-ppx/ocamlformat#2551, Fix missing parentheses around let..in with attribute ocaml-ppx/ocamlformat#2564, Fix dropped attribute in (module M : S [@attr]) ocaml-ppx/ocamlformat#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 format
open[@attr] M
asopen M [@@attr]
.Remove trailing space inside a wrapping empty signature (Fix trailing space in empty signature ocaml-ppx/ocamlformat#2443, @Julow)
Fix extension-point spacing in structures (Consistent spacing between items with extension ocaml-ppx/ocamlformat#2450, @Julow)
* Consistent break after string constant argument (Consistent break after string constant argument ocaml-ppx/ocamlformat#2453, @Julow)
* Fix cinaps comment formatting to not change multiline string contents (Fix cinaps comment formatting to not change multiline string contents. ocaml-ppx/ocamlformat#2463, @tdelvecchio-jsc)
* Fix the indentation of tuples in attributes and extensions (Fix indentation of tuples in payloads ocaml-ppx/ocamlformat#2488, @Julow)
* Fix weird indentation and line breaks after comments (Fix unwanted alignment after comment ocaml-ppx/ocamlformat#2507, Preserve comment placement after a
then
orelse
ocaml-ppx/ocamlformat#2589, Fix unecessary break due to comment in polymorphic variants ocaml-ppx/ocamlformat#2606, @Julow)* Fix unwanted alignment in if-then-else (Avoid alignment in if-then-else ocaml-ppx/ocamlformat#2511, @Julow)
Fix missing parentheses around constraint expressions with attributes (Bug fix:
Pexp_constraint
with attributes should get parenthesized ocaml-ppx/ocamlformat#2513, @alanechang)Fix formatting of type vars in GADT constructors (Fix formatting of type vars in GADT constructors ocaml-ppx/ocamlformat#2518, @Julow)
Fix
[@ocamlformat "disable"]
in some cases (Keep the location of 'in' keywords in local bindings ocaml-ppx/ocamlformat#2242, Fixes a bug in class type when trying to disable ocamlformat. ocaml-ppx/ocamlformat#2525, @EmileTrotignon)This caused a bug inside
class type
constructs and when attached to alet ... in
Display
a##b
instead ofa ## b
and similarly for operators that start with # (fix up spacing inf a#:b
(instead off a #: b
) ocaml-ppx/ocamlformat#2580, @v-gb)* Fix arrow type indentation with
break-separators=before
(Fix arrow type indentation with break_separators=before ocaml-ppx/ocamlformat#2598, @Julow)Fix missing parentheses around a let in class expressions (Fix parenthesing of let in class expressions ocaml-ppx/ocamlformat#2599, @Julow)
Fix formatting of paragraphs in lists in documentation (odoc: Fix formatting of paragraphs in lists ocaml-ppx/ocamlformat#2607, @Julow)
Avoid unwanted space in references and links text in documentation (odoc: Don't add unecessary space in references and links ocaml-ppx/ocamlformat#2608, @Julow)
* Improve the indentation of attributes in patterns (Improve indentation of attributes in patterns ocaml-ppx/ocamlformat#2613, @Julow)
* Avoid large indentation in patterns after
let%ext
(Break after 'let%ext' ocaml-ppx/ocamlformat#2615, @Julow)