ocamlformat icon indicating copy to clipboard operation
ocamlformat copied to clipboard

Feature request: respect indicate-multiline-delimiters in more cases

Open craigfe opened this issue 5 years ago • 1 comments

We have a few examples of parentheses that respect indicate-multiline-delimiters:

(* Respecting indicate-multiline-delimiters *)

;;
match a with
| _ -> (
    match b______________________________ with
    | _ -> c_____________________________ )

;;
( a______________________________________
$ b______________________________________ )
@ c

but also many that do not. Most of the offenders are parentheses added to attach attributes correctly (I suspect that are a lot of these),

(* Not respecting indicate-multiline-delimiters *)

;;
(f a
 [@attr_____________________________________________________________________])
  ()

;;
a
|> (b__________________________ c________________________
      d_______________________ [@attr])

but there are also things such as sugared local opens:

;;
Arg.(
  a______________________________________
  $ b____________________________________)

This suggests to me that these parentheses should all be handled by a single pretty-printer that respects the config.

craigfe avatar Apr 29 '20 10:04 craigfe

Related to https://github.com/ocaml-ppx/ocamlformat/pull/1169, but attributes and local opens have never been right I think.

jberdine avatar Apr 30 '20 00:04 jberdine