如何在IntelliJ IDEA中为Scala配置代码样式

时间:2015-04-02 05:51:59

标签: scala intellij-idea indentation code-formatting

IntelliJ格式化我的测试代码:

  test("a configuration without classpath to analyze is not valid") {
                                                                  Configuration(
                                                                    None,
                                                                    Seq(),
                                                                    Seq(),
                                                                    Map(),
                                                                        Some(PrintConfiguration(print = Always("output")))
                                                                  ) should not be ('valid)
                                                                }

我希望我们都同意这是一种相当愚蠢的方法。

如何配置IntelliJ,以便将Configuration和属于它的所有内容移到左侧,两个空格相对于test缩进?

澄清一下:大多数代码都是正确缩进的,只是花括号中的代码块,即参数相对于开头大括号而言相对于函数调用的开头而言相对而言。

1 个答案:

答案 0 :(得分:7)

设置如何 - > CodeStyle - >阶:

enter image description here

另外,请确保删除“多线设置时对齐”或在“环绕和括号”选项卡上设置“不对齐块表达式参数”。