Created
September 19, 2016 10:13
-
-
Save lambdista/e5db0b83676a1ee1b2b4109fc2c136af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// using scalafmt if I format a class whose fields run over the max length the resulting code looks like this: | |
final case class FooBarBaz(foo: String, | |
bar: Int, | |
baz: Long, | |
...) | |
// BUT if, before formatting, I do something like the following: | |
final case class FooBarBaz( | |
foo: String, | |
bar: Int, | |
baz: Long, | |
... | |
) | |
// the result of scalafmt is this one: | |
final case class FooBarBaz( | |
foo: String, | |
bar: Int, | |
baz: Long, | |
... | |
) | |
// which is something I like more then the default. Do you think it's a feature that can be considered, | |
// maybe through a flag? The real question is if there are enough users that | |
// would prefer this formatting too so that it's the case considering it as a new feature to be added. | |
// Same thing for methods. Result from scalafmt: | |
def foobarbazfoobarbaz(a: Int, b: String, c: Long, d: String)(implicit I: Int, | |
L: Long, | |
S: String): String = { | |
??? | |
} | |
// I like the following more: | |
def fdsffdfdfsfsefsdfdsfdsfdsfdsfdsfdf( | |
a: Int, | |
b: String, | |
c: Long, | |
d: String | |
)( | |
implicit I: Int, | |
L: Long, | |
S: String | |
): String = { | |
??? | |
} | |
// or, at least this one: | |
def fdsffdfdfsfsefsdfdsfdsfdsfdsfdsfdf( | |
a: Int, | |
b: String, | |
c: Long, | |
d: String | |
)(implicit I: Int, L: Long, S: String): String = { | |
??? | |
} | |
// Of course, this could just be my taste in which case I would not pretend | |
// this feature just for me! :-) |
@lambdista can you try --style intellij? I think it works similar to what you're describing here.
@gabro I've seen that style for implicits in a lot of places and I'm definitely happy to add it. I usually don't write code with so many implicits so it never bugged me : ) Could you open an issue?
Yeah, definitely. I used that style for implicits too and love it. The first time I saw it it was on a shapeless code snippet, If I can remember correctly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
regarding implicits, I manually do something like
which makes the implicit list tidier