How to use metaocaml with ocamlformat?

I use vim+ocamlformat to edit OCaml files. However, when I edit files with brackets from BER MetaOCaml, the bracket syntax gets expanded to attributes. e.g. let _ = .<1>. expands to let _ = (1 [@metaocaml.bracket]).

Is there a workaround to avoid this behaviour?

I think ocamlformat would need to be extended to understand the MetaOcaml attributes. As far as I know, there aren’t any other attributes that are treated this way (as syntax in the source, then attributes in the Parsetree). It doesn’t seem like it’d be a large patch to ocamlformat though.

1 Like

Hi,

ocamlformat does not support this at the moment.
You can open a feature request here if you’d like.

2 Likes
1 Like