Formatter Oddness?

it has been formatting this way for a long time, but I wanted to see if it was intended or not or if there was a particular combination of options I could use to make it format how I want:


Here is how it formats with default:
 
case class Foo() {
  def a(f: (Any) => Unit): Foo = this
}

Foo()
  .a { x =>
  x
}
  .a { x =>
  x
}


I think it should be:

 
case class Foo() {
  def a(f: (Any) => Unit): Foo = this
}

Foo()
  .a { x =>
    x
  }
  .a { x =>
    x
  }



Notice that the braces should not go all the way to the left, and the function body should be indented two steps from it's bottom (closing) brace

If I use parens, the parens line up correctly, but the body of the function is aligned with the lower parens, rather than two spaces over from that e.g.:

 
Foo()
  .a(x =>
  x
  )
  .a(x =>
  x
  )



should be

 
Foo()
  .a(x =>
    x
  )
  .a(x =>
    x
  )
0

BTW the motivation behind this is in using scalajs-react library, coding things in the style from the examples leads to the code looking pretty ugly when the intellij formatter pulls stuff too far to the left.

https://japgolly.github.io/scalajs-react/#examples/todo

0

Hi, Benjamin.

It is actually a well-known issue that has been addressed a while ago: https://youtrack.jetbrains.com/issue/SCL-5376.

Updating plugin to the latest version should resolve it for you. If it does not and the issue persists, please inform me by adding a comment to the above issue in the bug tracker.

Thank you.

0

Ok, I had been using 14.1 instead of the EAP which is why i wasn't seeing it.

It works great now

Thanks!

0

请先登录再写评论。