Right now IntelliJ's autoformat changes this:
val reduceFn = (left: U, right: U) => {
left ++ right // comment 1
.myFuncA( _._1 ) // comment 2
.myFuncABC { // comment 3
g => { // comment 4
g.myFun
._2
.myFunBBB( 0 )( _ + _ )
}
}
}: U // comment 5
to this:
val reduceFn = (left: U, right: U) => {
left ++ right // comment 1
.myFuncA( _._1 ) // comment 2
.myFuncABC {
// comment 3
g => {
// comment 4
g.myFun
._2
.myFunBBB( 0 )( _ + _ )
}
}
}: U // comment 5
Is there a way I can tell IntelliJ to produce, or, at the very least, not clobber the former style? I don't see comments as an option in Code Style in Editor > Code Style > Scala:
Unfortunately, I don't think this is supported at the moment. There's a ticket for it (SCL-4269), but as of writing there has not been any real activity on it.
You can completely disable the formatter for certain lines by using the formatter control option (cf. Code Style preference page). But that's obviously not a good solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With