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

Jen*_*der 7 scala code-formatting indentation intellij-idea

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)
                                                                }
Run Code Online (Sandbox Code Playgroud)

我希望我们都同意这是一个相当愚蠢的方法来做到这一点.

如何配置IntelliJ以使其移动Configuration并且属于它的所有内容都向左移动,两个空格相对于test

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

dk1*_*k14 7

如何设置 - > CodeStyle - > Scala:

在此输入图像描述

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