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

Remove profiles 'compact' and 'sparse' #2075

Merged
merged 2 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Removed

- Profiles `compact` and `sparse` are now removed (#<PR_NUMBER>, @gpetiot)
gpetiot marked this conversation as resolved.
Show resolved Hide resolved

### Deprecated

- Cancel the deprecations of options that are not set by the preset profiles (#2074, @gpetiot)
Expand Down
66 changes: 3 additions & 63 deletions lib/Conf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1568,61 +1568,6 @@ let conventional_profile =

let default_profile = conventional_profile

let compact_profile =
{ ocamlformat_profile with
break_before_in= `Auto
; break_cases= `Fit
; break_collection_expressions= `Wrap
; break_infix= `Wrap
; break_fun_decl= `Wrap
; break_fun_sig= `Wrap
; break_sequences= false
; break_struct= false
; doc_comments_tag_only= `Fit
; exp_grouping= `Parens
; field_space= `Tight
; if_then_else= `Compact
; indicate_nested_or_patterns= `Space
; leading_nested_match_parens= false
; let_and= `Compact
; let_binding_spacing= `Compact
; let_module= `Compact
; module_item_spacing= `Compact
; single_case= `Compact
; space_around_arrays= false
; space_around_lists= false
; space_around_records= false
; space_around_variants= false
; type_decl= `Compact
; wrap_fun_args= true }

let sparse_profile =
{ ocamlformat_profile with
break_before_in= `Fit_or_vertical
; break_cases= `Nested
; break_collection_expressions= `Fit_or_vertical
; break_infix= `Fit_or_vertical
; break_fun_decl= `Smart
; break_fun_sig= `Smart
; break_sequences= true
; break_struct= true
; field_space= `Loose
; if_then_else= `Keyword_first
; indicate_nested_or_patterns= `Space
; leading_nested_match_parens= true
; let_and= `Sparse
; let_binding_spacing= `Sparse
; let_module= `Sparse
; module_item_spacing= `Sparse
; single_case= `Sparse
; sequence_blank_line= `Preserve_one
; space_around_arrays= true
; space_around_lists= true
; space_around_records= true
; space_around_variants= true
; type_decl= `Sparse
; wrap_fun_args= false }

let janestreet_profile =
{ align_constructors_decl= false
; align_cases= false
Expand Down Expand Up @@ -1702,14 +1647,6 @@ let (_profile : fmt_opts option C.t) =
\"conventional\" appearing as the available options allow."
; C.Value.make ~name:"default" (Some default_profile)
"$(b,default) is an alias for the $(b,conventional) profile."
; C.Value.make ~name:"compact" (Some compact_profile)
~deprecated:deprecated_orphan
"The $(b,compact) profile is similar to $(b,ocamlformat) but opts \
for a generally more compact code style."
; C.Value.make ~name:"sparse" (Some sparse_profile)
~deprecated:deprecated_orphan
"The $(b,sparse) profile is similar to $(b,ocamlformat) but opts \
for a generally more sparse code style."
; C.Value.make ~name:"ocamlformat" (Some ocamlformat_profile)
"The $(b,ocamlformat) profile aims to take advantage of the \
strengths of a parsetree-based auto-formatter, and to limit the \
Expand All @@ -1731,6 +1668,9 @@ let (_profile : fmt_opts option C.t) =
"The $(b,janestreet) profile is used at Jane Street." ]
in
C.choice ~names ~all ~doc ~kind:C.Formatting
~removed_values:
[ C.Value_removed.make ~name:"compact" ~since:V0_22_0 ~msg:""
; C.Value_removed.make ~name:"sparse" ~since:V0_22_0 ~msg:"" ]
(fun conf p ->
selected_profile_ref := p ;
let new_fmt_opts = Option.value p ~default:conf.fmt_opts in
Expand Down
11 changes: 10 additions & 1 deletion lib/Version.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
(* *)
(**************************************************************************)

type t = V0_10_0 | V0_12_0 | V0_14_2 | V0_16_0 | V0_17_0 | V0_20_0 | V1_0_0
type t =
| V0_10_0
| V0_12_0
| V0_14_2
| V0_16_0
| V0_17_0
| V0_20_0
| V0_22_0
| V1_0_0

let to_string = function
| V0_10_0 -> "0.10.0"
Expand All @@ -18,6 +26,7 @@ let to_string = function
| V0_16_0 -> "0.16.0"
| V0_17_0 -> "0.17.0"
| V0_20_0 -> "0.20.0"
| V0_22_0 -> "0.22.0"
| V1_0_0 -> "1.0.0"

let pp fs v = Format.fprintf fs "%s" (to_string v)
Expand Down
10 changes: 9 additions & 1 deletion lib/Version.mli
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
(* *)
(**************************************************************************)

type t = V0_10_0 | V0_12_0 | V0_14_2 | V0_16_0 | V0_17_0 | V0_20_0 | V1_0_0
type t =
| V0_10_0
| V0_12_0
| V0_14_2
| V0_16_0
| V0_17_0
| V0_20_0
| V0_22_0
| V1_0_0

val to_string : t -> string

Expand Down
Loading