scalameta / scalafmt

Code formatter for Scala
http://scalameta.org/scalafmt
Apache License 2.0
1.44k stars 276 forks source link

Inconsistent formatting for variadic-like code #348

Closed densh closed 8 years ago

densh commented 8 years ago

https://github.com/scala-native/scala-native/blob/master/nativelib/src/main/scala/scala/scalanative/native/FunctionPtr.scala#L11

I'm reasonably happy with the output up until fromFunction15. Afterwards it just explodes size-wise. Inconsistency in formatting is quite glaring, plus the code becomes too big size-wise for no good reason.

Using:

sjrd commented 8 years ago

IMO that's a case where you would disable scalafmt for the definition of those functions. They look much too much like generated code, and it's conter-productive to enforce line length on them.

olafurpg commented 8 years ago

I agree that the output from scalafmt takes too many lines. Bin-packing is probably the way to go to get more compact formatting + more consistency between the longer and shorter functionX. As @sjrd mentions and we discussed in #347, your current option is to disable scalafmt for that file and once #315 is implemented you will be able to enable bin-packing for specific regions of code.

densh commented 8 years ago

315 is a decent solution for this problem.