ocaml-ppx / ocamlformat

Auto-formatter for OCaml code
MIT License
633 stars 179 forks source link

Always treat multiline `{|delimited strings|}` as though they are long #2480

Closed dvulakh closed 12 months ago

dvulakh commented 1 year ago

Currently, ocamlformat determines whether a delimited string is "long" enough to split a box across multiple lines simply by its length. However, a multiline string should always be treated as long enough to split a box, even if it doesn't have so many characters. This feature implements the desired behavior.

We implement the fix by exposing str_as in Fmt.mli so that we can use it to append short strings that get treated as very long after multiline strings.