Intellij中的链式方法和连续缩进 [英] Chained methods and continuation indent in Intellij
问题描述
我从来没有想过如何让Intellij正确处理链式方法的延续缩进,显然今天是让我恼火的一天,可以向您咨询可爱的人。
makeAThing(
with,
params
)
.setProperty(with more params)
.start();
我得到的是:
<$ p $ b $ make $ b $ make $ b $ make $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $。开始();
我在Java,Groovy,JavaScript和其他一些地方得到了这个。如何说服Intellij在链式方法调用之后不要添加连续缩进?
我刚切换到intellij,这很烦人。
只有找到两个解决方案:
- 强制编码风格为0 继续缩进,我开始喜欢,尽管不是非常规范的Java。
- 关闭代码块的格式化程序,然后按shift标签
适用于Java的JS不确定:
// @formatter :关
...
// @formatter:在
I've never figured out how to make Intellij handle continuation indent for chained methods properly, and apparently today is the day it's annoyed me enough to consult you lovely people.
What I want is this:
makeAThing(
"with",
"params"
)
.setProperty("with some more params")
.start();
What I get is this:
makeAThing(
"with",
"params"
)
.setProperty("with some more params")
.start();
I get this in Java, Groovy, JavaScript and a bunch of other places. How can I persuade Intellij not to add continuation indent after a chained method call?
I just switched to intellij and also have found this rather annoying.
Only found two solutions:
- forcing the coding style to have 0 for "continuation indent" which I'm starting to like anyway albeit not very canonical Java.
- Turing off the formatter for blocks of code and press shift tab
Works for Java not sure for JS:
// @formatter:off
...
// @formatter:on
这篇关于Intellij中的链式方法和连续缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!