reasonml / reason

Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
http://reasonml.github.io
MIT License
10.08k stars 425 forks source link

WIP Prettier Printing of function calls DO NOT MERGE #2679

Open jordwalke opened 1 year ago

jordwalke commented 1 year ago

This demonstrates how to achieve prettier printing of function calls. Sending a PR just for discussion. It is based on a really old commit of Reason, but shouldn't be too hard to rebase and fix the regressions. Instead of:

let x =
  reallyLongFunction(
    arg,
    arg,
  );

It will print:

let x = reallyLongFunction(
  arg,
  arg,
);

In its current state it also applies the same convention to other constructs which should not be wrapped in that manner - it's just a matter of going through and telling the printer which style to use in each case. I included some test output changes which demonstrate both some improvements and some regressions in printing.