Skip to content
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

Js #11

Open
wants to merge 575 commits into
base: main
Choose a base branch
from
Open

Js #11

wants to merge 575 commits into from

Conversation

J494-bit
Copy link

Me gustaría probar

@J494-bit
Copy link
Author

Go

Julow and others added 26 commits March 9, 2023 18:46
Make sure to drop locations from the "remaining" set to avoid the
"Some locations have not been considered" warning.
For consistency with ocp-indent.
Inline functions passed as labelled argument were not consistently
formatted when they were not the last argument.
Formatting for Pexp_newtype must follow Pexp_fun for consistency.
* tools/test_branch.sh: Allow passing pre-built binaries

Add the '-n' option that allow passing binaries through '-a' and '-b'.
When this option is passed, ocamlformat will not be rebuilt and no opam
environment is needed.

* GA: Reuse build artifacts when running test_branch

Avoid building ocamlformat for every test_branch jobs. Artifacts are
uploaded after the main build job and downloaded by the test_branch
builds.

* Move jobs to the same workflow

The `needs` option requires jobs to be in the same workflow file.
Reduces the diff between ocamlformat and ocp-indent in the janestreet
profile.

This is implemented as a separate, internal option instead of relying on
the 'ocp_indent_compat' option to show that the two call sites are
related.
* tools/printast: Print extended AST

This is the equivalent of `ocamlc -dparsetree` for out "extended AST".

Usage:

    dune exec -- tools/printast/printast.exe test.ml

* Move 'kind_of_ext' to the library

and add Extended_ast.of_syntax. Existential wrappers are needed to be
able to pass these values around.

Allow 'printast' to use the 'Extended_ast' module from the library. It
now outputs the normalized AST.
Make class signatures more consistent with class structures. This does not make class signature consistent with function signatures yet but is a step in the right direction.

Co-authored-by: Guillaume Petiot <[email protected]>
* Normalize away Ptyp_poly in patterns

This is done for expression but missing for patterns.

* Shorter syntax for first class modules

The long form for module packing is automatically rewritten into the
short form:

    let _ = ((module M) : (module S))
    let _ = (module M : S)

The following code has an equivalent AST but is not shortened:

    let _ : (module S) = (module M)
* ocp-indent-compat: Break label if '->' doesn't fit

Ocp-indent will align the argument list with the 'fun' keyword:

    foo ~bar:(fun
               baz ->

We must make sure to break this into:

    foo
      ~bar:
        (fun
          baz ->
The mutable keyword is allowed to break due to comment. Make sure this happen only when necessary.

Bug introduced in 04da581
* Remove double parenthesis around tuple in a match

The formatting for tuples doesn't respect the `~parens` mechanism due to
the `parens_tuple` option.

* Move cases indentation and parens decisions to Params

The formatting for cases is influenced by many options and special
cases. Move them to Params to make the formatting code manageable.
* test_branch.sh: Option to run ocp-indent

Add the '-o' option, which runs ocp-indent after each formatting steps.

* test_branch.sh: Option to not pull repositories

* GA: Run test-branch with ocp-indent for profile Janestreet

* test-branch: Pass --quiet to git and ocamlformat

* Run workflow on main branch
* Remove parens around match sugared type constraint

    fun a : t ->
      match b with

The AST for the code above looks like

    Pexp_fun (<a>, Pexp_constraint (Pexp_match _, <t>))

We must not use it as a context as this would add parenthesis in
ocp-indent-compat mode. Instead, create a ghost expression that do not
contain `Pexp_constraint` and use that as the context for the `match`.
* ocp-indent compat: Indent docked module expressions

This contains a fix for 'indicate-multiline-delimiters' in module packs.
* ocp-indent-compat: Dock trailing fun after infix

Indentation of the trailing fun of an apply should be indented starting
from the infix, not from the beginning of the apply.

The box structure is different depending on the option.

* Dock at every position in the pipeline

The `~epi` must be handled in every Pexp_apply cases.

* ocp-indent-compat: Trailing function

A trailing `function` is indented the same way as a trailing `fun`.
Unecessary boxes are removed when possible.
Julow and others added 30 commits October 31, 2024 11:03
This makes the changelog much more pleasing by adding examples, grouping
related entries and adding the Highlight section.
The boxing of paragraphs was wrong in heavy-syntax lists:

    (** Lists can't be nested
        {ul
         {- foo }
         {- module
            system
            documentation
            including
            + bar
            + baz
         }
        } *)
The previous formatting was:

    | (* Other inline element markup. *)
      `Simple_reference of
      string
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}. *)
* 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
* 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.
This avoids whitespaces from being removed by the HTML parser and
highlights strings that contain whitespaces to make them easy to see.
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) ) =
* 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 '}'
* 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
* 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.
Raw identifier syntax is added to the vendored lexer.

Contrary to upstream, the escape sequence (`\#`) is part of the ident.
This avoids the need to classify identifiers later in Fmt_ast.
Vendor required code from Misc.Utf8_lexeme, String, Bytes and Uchar.

Backport utf8 identifiers to standard and extended parser. This reduces the
diff with upstream.

* test: Add utf8_identifiers.ml

Taken from the compiler source.

* test_branch: Ignore parsing errors on 'infer'

The project contains a syntax error, that is new in OCaml 5.3:

    (** [x < min({x'|x'∊l})] *)
Backport the 5.3 changes related to the new `keyword_edition` feature and connect it to OCamlformat's `ocaml_version` option.
This will allow to parse pre-5.3 code that uses `effect` as identifiers.
* Backport metaocaml parser rules

This do not change the syntax but reduces the diff with upstream.

* Reduce diff between standard and extended parsers, lexers and vendored modules

* Correct location for type variables after 'as' in types

Comment-out the newline normalization code to reduce the diff and leave
a comment.

* test: Update source.ml

Take new source.ml test cases from upstream. Some test cases that were
added to source.ml by mistake are moved to relevant test files.
This fixes an AST changed error caught by test-branch in the compiler's
testsuite.

Co-authored-by: hhugo <[email protected]>
…ws (#2629)

Bumps [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) from 2 to 6.
- [Release notes](https://github.com/dawidd6/action-download-artifact/releases)
- [Commits](dawidd6/action-download-artifact@v2...v6)

---
updated-dependencies:
- dependency-name: dawidd6/action-download-artifact
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Backport the table feature from Odoc 2.4's parser and implement tables.

* Make sure elements in light table don't wrap

Invalid syntax was generated when elements had to wrap. This is fixed by
making sure all the elements in the table are inline elements and then
by formatting them without any break.

A smaller type is used to represent safely formattable light table that
do not contain any block elements.

The `~wrap` argument is added to `fmt_inline_elements` that controls
whether elements can wrap. This is passed explicitly rather than through
the config type to be sure that the information is not lost when
recursing through elements.
This fixed a potential bug in heading labels.

* Odoc 2.4's code blocks support delimiters and a output section.

* Add support for @hidden tag, quoted references and reduce diff with upstream
* Add support for media elements
* Support for the new tag syntax and new tags
* Backport changed newline parsing in code spans

* Wrap code spans if they are too long

If a code span exceed the margin, the line is broken before the code
spans. If a code span is on its own line and still break the margin,
then it is allowed to break.
The new parsing rules allow us to do that without changing the comment.
Light tables are formatted in two steps: all the cells are formatted
into strings first, then the table is assembled by adding the necessary
padding in each cells.

As a bonus, the alignment specified in the table is respected.
Bug introduced in #2618.
The tests don't pass when run with `dune build -p` option, as it's done
in Opam.
These files don't work well with dune-release. It seems that they were
not needed to begin with.
The `(modes)` field causes the build to fail on some 32bit platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.