scalameta / scalafmt

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

bitpacking and number of elements per line #1408

Closed borissmidt closed 3 years ago

borissmidt commented 5 years ago

Hey scalafmt team, I really like the formatter and i would like to make a feature request. (i can try to implement it myself with some help of you)

It seems that with bit packing you can set the minimum number of arguments for the packing to happen. I also think it would be a good idea if we could set the number of arguments per line. For example for Seq[Bit](0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) it would be cool if you could say. For Bit type i want exactly 8 parameters per line.

Seq[Bit](
   0,1,2,3,4,5,6,7,8,
   9,10,11,12,13,14,15)

Another feature i think that would be usefull is that you can break functions at a certain arguement count. for example i want to break all functions with more then 5 arguments even tough it doens't go out of the maximum line count.

borissmidt commented 5 years ago

Also is there any setting related to the inheritence keywords. for example if a class extends more then 3 traits it will put one statement per line

class TestSpec
    extends TestKit(something) with FlatSpecLike with BeforeAndAfter with Matchers
    with ImplicitHelper with Eventually {

becomes

class TestSpec
    extends TestKit(something) 
    with FlatSpecLike 
    with BeforeAndAfter 
    with Matchers
    with ImplicitHelper 
    with Eventually {