为构建者提供 Intellij 代码缩进

问题描述 投票:0回答:2

目前,如果我编写使用以下构建器类 Intellij 将按以下方式缩进

SomeClass.create()
    .someMethod()
    .someOtherMethod();

我希望它像这样缩进:

SomeClass.create()
         .someMethod()
         .someOtherMethod();

有人知道如何设置吗?

java intellij-idea intellij-14
2个回答
22
投票
  • 代码风格 => Java => 换行和大括号 => 链式方法调用
  • 多行时对齐

enter image description here

重新格式化源时产生以下内容:

enter image description here


0
投票

或者,如果您有 editorconfig 设置,您可以将以下属性添加到您的

.editorconfig
文件中:

© www.soinside.com 2019 - 2024. All rights reserved.