Organisationsocaml-ppxocamlformatbranch/mainBuild History

Build History for branch/main

Builds (68)
test: Test all profiles (#2618) * test: Test all profiles Format every test files for every profiles and promote the output to: test/passing/refs.<profile name>/ The generated dune rules are written in a way that they can be included in the profile directories. The main reason for this change is to increase the coverage for the default profile, which was barely tested. This also avoids tests without a ref file, which are frustrating to work with. The '.ref' extension for output files is not dropped to avoid confusing output files for input files. Duplicate test cases are removed (eg. between source.ml and js_source.ml). THe ocp-indent output is removed as it was not used anymore. 'verbose1.ml' test is removed because it doesn't work well with the `--name` option. The '.extra-deps' extension is also removed as it was not used. The size of the dune file is also slightly reduced because the (package) stanza could be removed.
8af2ec
Improve formatting of assignment operators with comments (#2617) * Improve formatting of assignment operators with comments Avoids outputting the assignment operator on the right of a long comment and removes the inconsistent 1-indent of the operator in some cases: let _ = - r (* _________________________________________________________________ *) := - 1 + r + (* _________________________________________________________________ *) + := 1 let _ = r - (* _________________________________________________________________ *) - (* _________________________________________________________________ *) - := 1 + (* _________________________________________________________________ *) + (* _________________________________________________________________ *) + := 1 Also fix an unstable comment in this case: let _ = aaaaaaa (* __________________________________________________________________________________ *) := bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb Which now formats the same way as other infix operators: let _ = aaaaaaa (* __________________________________________________________________________________ *) <> bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb * Update CHANGES
a91d4a
Improve indentation of attributes in patterns (#2613) * Improve indentation of attributes in patterns Small bug fix: let pp f ({cf_assign_last_arg; cf_injected_destructor; cf_interface} - [@warning "+9"] ) = + [@warning "+9"] ) = () * Avoid breaking after a lone '}'
fb9b70
Break after 'let%ext' (#2615) This avoids patterns being aligned after the end of the extension label: -let%server ( (s : int Eliom_shared.React.S.t) - , (f : (?step:React.step -> int -> unit) Eliom_shared.Value.t) ) = +let%server + ( (s : int Eliom_shared.React.S.t) + , (f : (?step:React.step -> int -> unit) Eliom_shared.Value.t) ) =
624eb8
box_debug: Highlight whitespaces (#2614) This avoids whitespaces from being removed by the HTML parser and highlights strings that contain whitespaces to make them easy to see.
404e83
janestreet: Fix indent of comments in records (#2612)
4c5c7b
Backport 5.3 short functor type syntax (#2611) * Backport 5.3 short functor type syntax * Preserve short syntax for functor types The extended AST now encodes whether a functor was using the short syntax with a boolean. The Pmty_gen constructor is removed from the extended AST as it can now be encoded as a Pmty_functor with the short flag set to true.
beb7ac
Backport 5.3 changes to Parsetree.constant (#2610)
6e349f
Backport 5.3 changes to Format_doc and Location (#2609) * Backport 5.3 changes to Format_doc and Location Backport compiler libs changes related to printing to the vendored parsers. * Backport changes to code highlighting in errors * Disable Build_path_prefix_map feature Instead of vendoring Build_path_prefix_map as well, the file name rewriting is commented-out. This feature doesn't make sense in ocamlformat. * Fix build on 4.08 Stdlib shims are needed by the parser shims
ba0f78
odoc: Don't add unecessary space in references and links (#2608) Avoid adding a space before the text of a reference or link: {{!ref}text} {{:url}text} As regular comments might be formatted as docstrings, the space must be preserved if it appears in the source to avoid crashing. odoc-parser is changed to preserve this information. This slightly changes the formatting of references and links: {{:https://github.com/mirage/irmin/blob/main/README_PPX.md} documentation - for [ppx_irmin]})*) + for [ppx_irmin]})*) ... - of similar bindings themselves, by using the appropriate {{!Merge.MSet} - multi-sets}. *) + of similar bindings themselves, by using the appropriate + {{!Merge.MSet} multi-sets}. *)
2ba547
Fix unecessary break due to comment in polymorphic variants (#2606) The previous formatting was: | (* Other inline element markup. *) `Simple_reference of string
7ebe9f
odoc: Fix formatting of paragraphs in lists (#2607) The boxing of paragraphs was wrong in heavy-syntax lists: (** Lists can't be nested {ul {- foo } {- module system documentation including + bar + baz } } *)
0df698
Editorialize the changelog (#2605) This makes the changelog much more pleasing by adding examples, grouping related entries and adding the Highlight section.
3cb0c2
Build on OCaml 5.3 (#2603) Co-authored-by: Adam CholewiƄski <theadamcholewinski@gmail.com>
50946d
Fix dropped attribute in (module M : S [@attr]) (#2602) The attributes were lost by mistake in the patched parser.
864d6a
Fix parenthesing of let in class expressions (#2599) Missing parentheses caused an AST changed error.
36e1ca
Fix arrow type indentation with break_separators=before (#2598)
cd80d5
Wrap short fun after a let with the janestreet profile (#2593)
8bc9f0
Un-indent comment after fun (#2592) This indentation is not useful and is new in the janestreet profile.
35ef39
Represent 'let f _ = function' in the CST (#2596) * extended: Missing Printast for pvb_is_pun and pvb_args * Pass the right context when formatting let bindings This fixes various inconsistencies and will help write parens rules for functions. * Represent 'let f _ = function' in the CST Currently, the CST represents the arguments of 'let f _ =' in a way that is incompatible with the changed function representation from OCaml 5.2. These two are represented the same way in the CST: let f _ = function ... let f _ = (function ...) To fix this problem, the representation for let bindings bodies is changed to 'function_body', matching the 5.2 representation. * Remove unecessary parentheses around functions in bindings By implementing stronger Ast checks.
500977
Preserve comment placement after a `then` or `else` (#2589) * Improve comment placement after a `then` or `else` Allow comments on the same line as `then` and `else`, as it was the case in 0.26.2. Also, make sure to avoid formatting any code after a comment in that position. This was broken since #2507. * Preserve placement of comments after a `then` or `else` To avoid generating a large number of diffs, the locations of then and else keywords are added to the AST. This new information is used to preserve different cases: if cond then (* attached to then *) expr; if cond then (* attached to expr *) expr; if cond then (* attached to expr *) expr;
dca751
Fix 'function' indent in methods with no-wrap-fun-args (#2590) * test: More coverage of --no-wrap-fun-args * Fix 'function' indent in methods with no-wrap-fun-args Fix a recent bug that impacts js_of_ocaml.
822985
parser-extended: Add missing Ast_mapper rule (#2591)
d97e99
Backport Pexp_function from OCaml 5.2 (#2544) Backport the OCaml 5.2 `Pexp_function` node to the extended parser. All the different pieces of code that format functions are merged into a single place. This requires adding a lot of special cases to re-implement the various ways functions were formatted before. Some of these special cases could be removed in the future. Co-authored-by: Guillaume Petiot <guillaume@tarides.com> Co-authored-by: Emile Trotignon <emile.trotignon@gmail.com>
3386dc
Pick tests added in #2544 (#2588) This will make the changes in #2544 easier to interpret.
51800a
Stricter AST checks (#2557) * Normalize docstrings using the extended AST This use the extended AST normalization for docstrings within the std AST. This ensures that repl phrases are handled correctly and removes some code. * Stricter AST checks The AST check was previously trigerring if both the std AST and the extended AST were different. The std AST is intended to be the most trustworthy and is intended to catch changes in the code that the extended AST couldn't.
9dbce3
Fix missing parentheses around let..in with attribute (#2564) On a side note, parentheses around let..in shouldn't have `~fits_break:false`, but changing that would cause large diffs.
ca77ba
Add stacktraces to the html debug output (#2567)
6aaac0
Backport 5.2 changes to parser-standard (#2512) Backport the remaining parser and lexer changes except for Pexp_function. Co-authored-by: Guillaume Petiot <guillaume@tarides.com>
7f20ec
CI: Fix test-branch after external action change (#2584)
e9dbd6
fix up spacing in `f a#:b` (instead of `f a #: b`) (#2580)
f95975
Allow custom commands for running ocamlformat (#2577) Currently it's possible to customize the path or name of the ocamlformat executable that gets run by the emacs ocamlformat package. However sometimes it's desirable to run ocamlformat by running a multi-word command, such as `opam exec ocamlformat --`. This change adds support running coamlformat with custom multi-word commands by allowing the `ocamlformat-command` variable to be set to a list of strings. Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
f8e16b
Extract tests from the 5.2 compat PR (#2578) This will make the diffs more readable.
8cf0db
tests: Add source-conventional.ml.ref (#2575)
923486
CI: Update actions/upload-artifact (#2574) to a version matching actions/download-artifact. This was causing it to fail.
4a5d64
CI: Disable test-branch on main (#2573) Might allow to workflow to complete since the recent update. This CI job is not useful.
0ba448
Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows (#2572) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7. Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
53263b
Correct --wrap-comments doc on docstrings (#2568) --wrap-comments do not apply to docstrings.
f54155
add box_debug to new fmt combinators for breaks (#2566)
2677e0
vscode debugger config (#2554)
8421be
Box debug not showing break_unless_newline and fits_or_breaks (#2553) Format the box_debug output as length 0 with pp_print_as and remove the indentation in the output HTML. This was interfering with many instances of break_unless_newline and fits_or_breaks and caused hair loss during previous debugging sessions.
c43f89
Improve the placement of begin..end attributes (#2551) * Parenthese begin..end with attributes This fixes a AST changed bug by adding parentheses. * Improve the placement of begin..end attributes Render 'begin [@attr] .. end' instead of 'begin .. end [@attr]'. This removes parentheses. * Update changes
b6867b
Fix doc-comments '*)' exceeding the margin (#2550) This change applies to doc-comments and regular comments parsed as doc-comments.
099d6e
Backport changelog from the 0.26 branch (#2548)
356ec7
Fix comments around underscore in record patterns (#2540) Remove the added empty line and the extraneous space with `break-separator=after`. Fix unstable comment with `break-separator=before`.
6e5a1e
Fix dropped comments before begin-end case (#2541)
49af11
Fix missing parenthesis after try..with (#2537) When indicate-multiline-delimiters=closing-on-separate-line, the closing parenthesis at the end of a try..with expression is missing since #2528.
54fff6
Simplify representation of class field values and methods (#2529)
6ce00b
Add object.ml.ref (#2532)
8db3e2
Check dune fmt in the github actions (#2530)
57d9a1
Preserve position of attributes on structure items (#2247) * Add `ext_attrs` to: include statements open statements classes type declarations let bindings `value_description` type extensions exceptions * Fixes a bug where, in signatures, ```ocaml type%foo t exception%foo X ``` was formatted as-is, but ```ocaml type t exception X ``` resulted in ```ocaml type t exception X ``` This was because for the first example, the "line-break-algorithm" (found in `Ast.Signature_item.allow_adjacent`), was making its decision as if the code to printed was : ```ocaml [%%foo type t] [%%foo exception X] ``` We know have more information in our AST which allows us to make a difference between `type%foo t` and `[%%foo type t]`.
b10d76
Removes format syntax (#2528) This is a big refactoring that completely removes format syntax such as `"@;<1000 -2>" from ocamlformat. Instead, documented combinators are used. * Remove Fmt.s * remove _k suffix * Remove flush
910dbf
use `force_break` value instead of `fmt "@;<1000 0>"` (#2526)
933870
Keep the location of 'in' keywords in local bindings (#2242) * add the location of "in" to fix #2096 * Improve handling of empty line after 'in' * add loc to let in in class Co-authored-by: Guillaume Petiot <guillaume@tarides.com>
137e61
Fixes a bug in class type when trying to disable ocamlformat (#2525)
169c48
Support Ptyp_open from OCaml 5.2 (#2519) * Backport Ptyp_open to parser-extended * Backport Ptyp_open to parser-standard
8c20da
Undo let-bindings normalizations, carry out the args to remove the sugaring (#2523)
26cffc
Expose let_binding_deindent_fun flag (#2521)
8d63ea
Fix formatting of type vars in GADT constructors (#2518) The formatting of type variables was short circuited when the constructor contained no argument.
b8b095
Bug fix: `Pexp_constraint` with attributes should get parenthesized (#2513) Fix a bug in formatting f ((1 : int) [@a]) where the outer pair of parentheses gets stripped. * Tweak Ast rules to avoid parentheses in records Avoid the extra parentheses in this case: {((a : b)) with c} * Add missing Ast rule for override fields Avoid parentheses in this case: {<x = (x [@a])>}
7db948
Add args to binding_ops (#2516)
e77f73
Cleanup Let_binding.split_annot (#2515)
9fae8a
Distinguish fun_param for expr/class, unify parsing of val/newtype fun_param (#2503)
4826c4
Backport 5.2 compilerlibs changes (#2510) * Update vendored compilerlibs for OCaml 5.2 Co-authored-by: Jules Aguillon <jules@j3s.fr>
37d9f6
Improvements to ocp-indent-compat and the Janestreet profile (#2314) The following changes apply when ocp-indent-compat is enabled: - Indent extensions and attributes containing structure items according to `stritem_extension_indent`. - Consistent indentation of regular and polymorphic variants types in type exprs, patterns and expressions. - Don't align pack expressions. - Consistent indentation of methods. - Tweak indentation of comments in records. - Tweak indentation of fun arguments.
cb9b35
Avoid alignment in if-then-else (#2511) * Add missing break after if-then-else keyword * Fix box within if-then-else branch Co-authored-by: Guillaume Petiot <guillaume@tarides.com>
aa2ec8
Fix unwanted alignment after comment (#2507) This removes the alignment in expressions like: let _ = try_with (fun () -> (* comment before *) a ; b (* after b *) ) Co-authored-by: Guillaume Petiot <guillaume@tarides.com>
841824
Fix unstable comment around docked functor arg (#2506)
9534fe