ocamlformat icon indicating copy to clipboard operation
ocamlformat copied to clipboard

Feature request: field-space, but for labeled arguments in declarations

Open ELLIOTTCABLE opened this issue 5 years ago • 1 comments

Is your feature request related to a problem? Please describe. At the moment, even with field-space = loose, the following ...

val mk :
  values : cmj_value Map_string.t ->
  effect : effect ->
  npm_package_path : Js_packages_info.t ->
  cmj_case : cmj_case ->
  t

formats to:

val mk :
  values:cmj_value Map_string.t ->
  effect:effect ->
  npm_package_path:Js_packages_info.t ->
  cmj_case:cmj_case ->
  t

This is not in-line with the style used across the project I'm trying to patch, and results in a lot of diff noise, unfortunately. I can't seem to find a feature that toggles the spacing around : colons in --intf files.

Describe the solution you'd like It'd be nice if either:

  1. field-space = lose automatically applied also to labeled-arguments in interfaces, or
  2. a new option to control this spacing was added

ELLIOTTCABLE avatar Feb 04 '20 06:02 ELLIOTTCABLE

Sorry for the late reply. The current direction of ocamlformat is to not add new options, but rather focus on improving the existing preset profiles (default, ocamlformat, janestreet).

I think not having a space around the : in this case is the most common style in the community but maybe I'm wrong, I'm not opposed to a change like this if the community pushes for it, any thought on this point @samoht @CraigFe @Julow @jberdine ?

gpetiot avatar Nov 05 '21 10:11 gpetiot