ocamlformat
ocamlformat copied to clipboard
do not break before match when that's the first body item of a function
Currently the following code:
let f x = match x.v with
| Foo asdasdassdasdasdadasasddaasdas ->
foosadadadasdsa asdadadadsa dadasdsadasdasdas
| Bar -> sdasdas
is formatted into:
let f x =
match x.y with
| Foo asdasdassdasdasdadasasddaasdas ->
foosadadadasdsa asdadadadsa dadasdsadasdasdas
| Bar -> sdasdas
would it be possible to keep the let f x = match x.y with on the same line?
Note that this sort of style, where the nesting of formatting boxes will need to be quite different from the nesting structure of the parsetree (because the indentation of the expression is not relative to the beginning of the expression) is involved and fragile in the current implementation. This is the sort of thing that introducing an intermediate structure between the parsetree and the formatting boxes would make easier.
Easier after #406
Given what's been said above, I'm not sure "Good first issue" is the right tag.
Sorry for the very late answer, out of curiosity is that a really common style in the ocaml community? I've never seen it anywhere (I mean yes for function ofc, I can conceive it for fun but never seen it with match)