scalaintellij-ideacommentsscaladoc

How do you modify block comment alignment in Intellij IDEA with Scala?


Currently when Intellij IDEA autocompletes block comments, e.g. typing /**+<return>, IDEA will create a block comment like so:

/** * Comment goes here */

However, scaladoc recommends that block comment bodies are aligned differently:

/** * Comment here */ (Note the whitespace difference).

How is this configured?


Solution

  • I can't see support for this in IntelliJ; I think if it was there, it would be under Preferences > Editor > Code Style > Java > JavaDoc. Even though it says JavaDoc, changing these settings also affects Scala and ScalaDoc code.

    I'd recommend using Scalariform to achieve this. Scalariform is a code formatter that will format you code on compile, regardless of what you type into IntelliJ. It has a setting called placeScaladocAsterisksBeneathSecondAsterisk which is exactly what you want.