Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Nov 26, 2024
1 parent 918887e commit abee119
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/Conf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,7 @@ module Formatting = struct
in
Decl.choice ~names ~all ~default ~doc ~kind
(fun conf elt ->
update conf ~f:(fun f -> {f with break_collection_expressions= elt})
)
update conf ~f:(fun f -> {f with break_collection_expressions= elt}) )
(fun conf -> conf.fmt_opts.break_collection_expressions)

let break_colon =
Expand Down Expand Up @@ -598,8 +597,7 @@ module Formatting = struct
Decl.choice ~names ~all ~default ~doc ~kind
(fun conf elt ->
update conf ~f:(fun f ->
{f with break_struct= Elt.make Poly.(elt.v = `Force) elt.from} )
)
{f with break_struct= Elt.make Poly.(elt.v = `Force) elt.from} ) )
(fun conf ->
let elt = conf.fmt_opts.break_struct in
if elt.v then Elt.make `Force elt.from
Expand Down Expand Up @@ -896,8 +894,7 @@ module Formatting = struct
in
Decl.choice ~names ~all ~default ~doc ~kind
(fun conf elt ->
update conf ~f:(fun f -> {f with indicate_nested_or_patterns= elt})
)
update conf ~f:(fun f -> {f with indicate_nested_or_patterns= elt}) )
(fun conf -> conf.fmt_opts.indicate_nested_or_patterns)

let infix_precedence =
Expand All @@ -924,8 +921,7 @@ module Formatting = struct
let names = ["leading-nested-match-parens"] in
Decl.flag ~names ~default ~doc ~kind ~allow_inline:false
(fun conf elt ->
update conf ~f:(fun f -> {f with leading_nested_match_parens= elt})
)
update conf ~f:(fun f -> {f with leading_nested_match_parens= elt}) )
(fun conf -> conf.fmt_opts.leading_nested_match_parens)

let let_and =
Expand Down Expand Up @@ -1547,8 +1543,8 @@ let parse_attr {attr_name= {txt; loc= _}; attr_payload; _} =
| _ when String.is_prefix ~prefix:"ocamlformat." txt ->
Error
(`Msg
(Format.sprintf "Invalid format: Unknown suffix %S"
(String.chop_prefix_exn ~prefix:"ocamlformat." txt) ) )
(Format.sprintf "Invalid format: Unknown suffix %S"
(String.chop_prefix_exn ~prefix:"ocamlformat." txt) ) )
| _ -> Error `Ignore

let update ?(quiet = false) c ({attr_name= {txt; loc}; _} as attr) =
Expand Down

0 comments on commit abee119

Please sign in to comment.