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

Question: Isn't it a regression? 0.25.1 -> 0.26.1 #2484

Open
Kakadu opened this issue Dec 2, 2023 · 3 comments
Open

Question: Isn't it a regression? 0.25.1 -> 0.26.1 #2484

Kakadu opened this issue Dec 2, 2023 · 3 comments

Comments

@Kakadu
Copy link

Kakadu commented Dec 2, 2023

The placement of a comma looks weird.

➜  /tmp cat a.ml                                                                       
      let rez =
        [%type:
          ( [%t ptyp_constr ~loc lident (List.map names ~f:(ptyp_var ~loc))]
          , [%t ptyp_constr ~loc lident_g (List.map names_2 ~f:(ptyp_var ~loc))] )
          OCanren.Reifier.t]
➜  /tmp ocamlformat a.ml                                                           
let rez =
  [%type:
    ( [%t ptyp_constr ~loc lident (List.map names ~f:(ptyp_var ~loc))]
    , [%t ptyp_constr ~loc lident_g (List.map names_2 ~f:(ptyp_var ~loc))] )
    OCanren.Reifier.t]
;;
➜  /tmp ocamlformat --version                                                               
0.25.1
➜  /tmp opam install ocamlformat.0.26.1                                                    
...
Done.
➜  /tmp ocamlformat a.ml                                                                          
let rez =
  [%type:
    ( [%t ptyp_constr ~loc lident (List.map names ~f:(ptyp_var ~loc))]
      , [%t ptyp_constr ~loc lident_g (List.map names_2 ~f:(ptyp_var ~loc))] )
      OCanren.Reifier.t]
;;
➜  /tmp ocamlformat --version                                                                       
0.26.1                                                                          
➜  /tmp cat .ocamlformat                                                                        
profile=janestreet
@Julow
Copy link
Collaborator

Julow commented Dec 4, 2023

This is done to improve compatibility with ocp-indent for those that use both in their formatting pipeline. This appeared in #2428 and can be avoided with the option ocp-indent-compat=false (--no-ocp-indent-compat on the CLI)

@Kakadu
Copy link
Author

Kakadu commented Dec 10, 2023

Thanks, it helps. Another question: is there a list of options to migrate from version A to A+1 without changing the OCaml code? I believe that ocamlformat --print-config --profile=janestreet doesn't give a full list.

P.S. The answer is probably no, because you mention hidden options which are not available outside #2414
P.P.S. It is not a shortcoming of janestreet profile, it hapens with default too. It looks like 0.26.1 had increased indent somehow, in a manner that it is not controlled my 'max-indent='

@@ -1731,8 +1722,8 @@ module Make (AstHelpers : GTHELPERS_sig.S) = struct
         self#wrap_tr_function_str ~loc tdecl
           (Exp.app_list ~loc (Exp.new_ ~loc @@ Lident class_name)
           @@ List.map rec_typenames ~f:(fun name ->
-                 Exp.fun_ ~loc (Pat.unit ~loc)
-                 @@ Exp.sprintf ~loc "%s_%s" self#plugin_name name)
+               Exp.fun_ ~loc (Pat.unit ~loc)
+               @@ Exp.sprintf ~loc "%s_%s" self#plugin_name name)
           @ self#apply_fas_in_new_object ~loc tdecl)
 
       method fancy_app ~loc trf (inh : Exp.t) subj = Exp.app ~loc trf subj

@Julow
Copy link
Collaborator

Julow commented Dec 11, 2023

There's no such backward compatibility options. We are very careful at the changes made to the default profile but that's not the case of the janestreet profile, which changes often.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants