目前,当 Intellij IDEA 自动完成块注释时,例如打字/**+<return>
,IDEA 将创建一个块注释,如下所示:
/**
* Comment goes here
*/
但是,scaladoc 建议块注释正文以不同的方式对齐:
/**
* Comment here
*/
(注意空格的区别)。
这是如何配置的?
目前,当 Intellij IDEA 自动完成块注释时,例如打字/**+<return>
,IDEA 将创建一个块注释,如下所示:
/**
* Comment goes here
*/
但是,scaladoc 建议块注释正文以不同的方式对齐:
/**
* Comment here
*/
(注意空格的区别)。
这是如何配置的?
Intellij 2018.2 现在默认支持此功能。
设置在Preferences > Editor > Code Style > Scala > ScalaDoc > Use ScalaDoc indent for leading asterisk
。
我在 IntelliJ 中看不到对此的支持;我想如果它在那里,它会在Preferences > Editor > Code Style > Java > JavaDoc
. 即使它说 JavaDoc,更改这些设置也会影响 Scala 和 ScalaDoc 代码。
我建议使用Scalariform来实现这一点。Scalariform 是一个代码格式化程序,它将在编译时格式化您的代码,无论您在 IntelliJ 中键入什么内容。它有一个名为placeScaladocAsterisksBeneathSecondAsterisk的设置,这正是您想要的。