如何使用 Scala 修改 Intellij IDEA 中的块注释对齐方式?

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

目前当 Intellij IDEA 自动完成块注释时,例如输入 /**+<return>,IDEA 将创建一个块注释,如下所示:

/** * Comment goes here */

但是,scaladoc 建议块注释主体以不同方式对齐:

/** * Comment here */ (注意空格差异)。

这是如何配置的?

我在 IntelliJ 中看不到对此的支持;我想如果它在那里,它会在 Preferences > Editor > Code Style > Java > JavaDoc 以下。尽管它说的是 JavaDoc,但更改这些设置也会影响 Scala 和 ScalaDoc 代码。

我建议使用 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,这正是您想要的。

Intellij 2018.2 现在默认支持这个。

设置在Preferences > Editor > Code Style > Scala > ScalaDoc > Use ScalaDoc indent for leading asterisk