syntax icon indicating copy to clipboard operation
syntax copied to clipboard

Formatter: multiline -> expressions and indentation inside records

Open johnridesabike opened this issue 4 years ago • 0 comments

Code currently formats like this:

type t = {x: int}
let f = x => {
  {
    x: x
    ->Belt.Option.map(succ)
    ->Belt.Option.map(succ)
    ->Belt.Option.map(succ)
    ->Belt.Option.getExn,
  }
}

The lines beginning with -> are aligned with the record field name, which looks confusing IMO.

Would it be better to format it like this?

type t = {x: int}
let f = x => {
  {
    x:
      x
      ->Belt.Option.map(succ)
      ->Belt.Option.map(succ)
      ->Belt.Option.map(succ)
      ->Belt.Option.getExn,
  }
}

The -> lines are more indented which seems clearer to me.

johnridesabike avatar May 17 '21 15:05 johnridesabike