Trailing line comment formatting still broken

There are cases where we want to add a simple trailing comment to the end of the line:

var state = List.empty[Int] // will be filled later
val id = computeId()

The IntelliJ formatter doesn't seem to support this. When you reformat (unless you enable "Keep when reformatting: Line breaks"), it will nonsensically move the trailing comment to the next line, which can be very misleading.

var state = List.empty[Int]
// will be filled later
val id = computeId()

This is a known issue, reported in this forum 4 years ago (https://devnet.jetbrains.com/message/5283773, https://youtrack.jetbrains.com/issue/SCL-2715) and elsewhere (http://stackoverflow.com/questions/29319187/intellij-code-style-to-align-single-line-comments, https://youtrack.jetbrains.com/issue/SCL-4269).

I'm posting in the vague hope that it will help bring some attention to it. Or does somebody have a solution?

4

Ugh, it's still broken as far as I can tell as well.

0
Avatar
Permanently deleted user

Still a problem with Scala in 2022. 

0

请先登录再写评论。