Skip to content

Add doc-comments-val=unset#1340

Merged
Julow merged 3 commits intoocaml-ppx:masterfrom
Julow:doc-comments-val-unset
Apr 17, 2020
Merged

Add doc-comments-val=unset#1340
Julow merged 3 commits intoocaml-ppx:masterfrom
Julow:doc-comments-val-unset

Conversation

@Julow
Copy link
Copy Markdown
Collaborator

@Julow Julow commented Apr 15, 2020

When doc-comments-val was added, the scope of doc-comments was reduced and
didn't overlap with the new option.
This is confusing because the name of the option suggest that doc-comments-val
overlap with doc-comments but not by default.

This also added unecessary maintainance to users of doc-comments, they had to
understand and add a new option to their config.

This new value is set by default. This may impact users who kept 0.14.0
defaults when upgrading to 0.14.1 (eg. setting doc-comments=before and
not setting doc-comments-val).

Closes #1338

When `doc-comments-val` was added, the scope of `doc-comments` was reduced and
didn't overlap with the new option.
This is confusing because the name of the option suggest that `doc-comments-val`
overlap with `doc-comments` but not by default.

This also added unecessary maintainance to users of `doc-comments`, they had to
understand and add a new option to their config.

This new value is set by default. This may impact users who kept 0.14.0
defaults when upgrading to 0.14.1 (eg. setting `doc-comments=before` and
not setting `doc-comments-val`).
; disambiguate_non_breaking_match= false
; doc_comments= `Before
; doc_comments_val= `Before
; doc_comments_val= `Unset
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the janestreet profile, I don't expect this to cause regressions.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see regressions with the doc-comments on core_kernel, so it looks safe to me

@gpetiot
Copy link
Copy Markdown
Collaborator

gpetiot commented Apr 15, 2020

It looks good to me (didn't made any tests yet, we need to check the diff compared to what we had on 0.13.0 this time).
Not important: how about we make the name of the variant value a bit more explicit: (the more obvious it is, the better)
doc-comments-val=

  • doc-comments
  • same-as-doc-comments
  • inherit-doc-comments

@Julow
Copy link
Copy Markdown
Collaborator Author

Julow commented Apr 16, 2020

I think it is already good enough. Options that overlap that way are intuitive and the name "unset" shows it clearly. A more complicated name would get in the way I think.

@gpetiot
Copy link
Copy Markdown
Collaborator

gpetiot commented Apr 17, 2020

No diff on irmin.
Here is the diff on dune, which looks better (and normal):

diff --git a/src/dune/colors.ml b/src/dune/.formatted/colors.ml
index 061f54d2..59714de3 100644
--- a/src/dune/colors.ml
+++ b/src/dune/.formatted/colors.ml
@@ -47,8 +47,8 @@ let setup_err_formatter_colors () =
     List.iter [ err_formatter; Dune_util.Report_error.ppf ] ~f:(fun ppf ->
         let funcs = (pp_get_formatter_tag_functions ppf () [@warning "-3"]) in
         pp_set_mark_tags ppf true;
-        (pp_set_formatter_tag_functions ppf
-           { funcs with
-             mark_close_tag = (fun _ -> Ansi_color.Style.escape_sequence [])
-           ; mark_open_tag
-           } [@warning "-3"]))
+        pp_set_formatter_tag_functions ppf
+          { funcs with
+            mark_close_tag = (fun _ -> Ansi_color.Style.escape_sequence [])
+          ; mark_open_tag
+          } [@warning "-3"])
Done: 4312/4779 (jobs: 4)File "src/dune_lang/t.ml", line 1, characters 0-0:
         git (internal) (exit 1)
(cd _build/default && /usr/bin/git diff --no-index --color=always -u src/dune_lang/t.ml src/dune_lang/.formatted/t.ml)
diff --git a/src/dune_lang/t.ml b/src/dune_lang/.formatted/t.ml
index b5abde53..f19cdcd4 100644
--- a/src/dune_lang/t.ml
+++ b/src/dune_lang/.formatted/t.ml
@@ -80,29 +80,29 @@ module Deprecated = struct
     let tfuncs =
       (Format.pp_get_formatter_tag_functions ppf () [@warning "-3"])
     in
-    (Format.pp_set_formatter_tag_functions ppf
-       { tfuncs with
-         mark_open_tag =
-           (function
-           | "atom" ->
-             state := In_atom :: !state;
-             ""
-           | "makefile-action" ->
-             state := In_makefile_action :: !state;
-             ""
-           | "makefile-stuff" ->
-             state := In_makefile_stuff :: !state;
-             ""
-           | s -> tfuncs.mark_open_tag s)
-       ; mark_close_tag =
-           (function
-           | "atom"
-           | "makefile-action"
-           | "makefile-stuff" ->
-             state := List.tl !state;
-             ""
-           | s -> tfuncs.mark_close_tag s)
-       } [@warning "-3"]);
+    Format.pp_set_formatter_tag_functions ppf
+      { tfuncs with
+        mark_open_tag =
+          (function
+          | "atom" ->
+            state := In_atom :: !state;
+            ""
+          | "makefile-action" ->
+            state := In_makefile_action :: !state;
+            ""
+          | "makefile-stuff" ->
+            state := In_makefile_stuff :: !state;
+            ""
+          | s -> tfuncs.mark_open_tag s)
+      ; mark_close_tag =
+          (function
+          | "atom"
+          | "makefile-action"
+          | "makefile-stuff" ->
+            state := List.tl !state;
+            ""
+          | s -> tfuncs.mark_close_tag s)
+      } [@warning "-3"];

Copy link
Copy Markdown
Collaborator

@gpetiot gpetiot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested irmin, dune and core_kernel. No issues on the doc-comments.

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.

Confusing interaction between options doc-comments and doc-comments-val

3 participants