dune icon indicating copy to clipboard operation
dune copied to clipboard

allow configuration of line length in auto formatting of dune files

Open Khady opened this issue 5 months ago • 0 comments

Desired Behavior

We could imagine having an option in dune-project to configure the maximum line length used by dune to format its files.

dune-project

(formatting (dune (margin 200)))

Dune tends to be very eager to spread things vertically when it goes over the the horizontal limit. And the horizontal limit is fairly low, at least in our opinion. It often reduces readability and density of the information. Raising the margin should limit this kind of behavior.

Example

(rule
 (target sql_file1.ml)
 (deps
  gen_file2.sql
  gen_file3.sql)
 (mode promote)
 (action
  (with-stdout-to
   %{target}
   (run
    sqlgg
    -static-header
    -gen
    caml_io
    -name
    Make
    -params
    unnamed
    -category
    none
    gen_file2.sql
    -category
    all
    gen_file3.sql))))

could become

(rule
 (target sql_file1.ml)
 (deps gen_file2.sql gen_file3.sql)
 (mode promote)
 (action
  (with-stdout-to %{target}
  (run sqlgg -static-header -gen caml_io -name Make -params unnamed -category none gen_file2.sql -category all gen_file3.sql))))

Khady avatar Aug 30 '24 09:08 Khady