Intellij Scala类定义格式

时间:2015-12-03 22:07:32

标签: scala intellij-idea code-formatting

如何让Intellij格式化我的Scala类定义:

      output  appended data as the file grows; -f, --follow, and --follow=descriptor are equivalent

每行的成员声明基本上有4个缩进,类继承有2个缩进。

1 个答案:

答案 0 :(得分:3)

从版本2016.2开始,可以通过Settings > Editor > Code Style > Scala下的默认值进行下一次更改来完成此操作:

  1. 取消选中Method declaration parameters > Align when multiline下的Wrapping and Braces
  2. 检查Alternate indentation for constructor args and parameter declarations下的Other并将其设置为4.
  3. 缺点是这不仅适用于构造函数参数,也适用于常规方法声明,因此您不能让方法参数与左括号对齐。但我想我们必须忍受这一点。