[英]Wrapping chained method calls on a separate line in Intellij for Java
[Copied from]: Wrapping chained method calls on a separate line in eclipse for Java [复制自]: 在 Eclipse for Java 中的单独一行上包装链式方法调用
For example, I have this:例如,我有这个:
someObject.A().B().C();
But I really want this:但我真的想要这个:
someObject.A()
.B()
.C();
I wanted to ask how to achieve that formatting in intellij.我想问一下如何在intellij中实现这种格式。 I was unable to achieve it.我无法实现它。 I want to use the same formatting given in this answer .我想使用此答案中给出的相同格式。
Small disclaimer: this is IJ 14.4, it's possible that in later versions it may have been changed/renamed/etc, but it should be there somewhere nonetheless小免责声明:这是 IJ 14.4,在以后的版本中它可能已被更改/重命名/等,但它应该在某个地方
Go to Settings
-> Editor
-> Code style
-> Java
and select the Wrapping and Braces
tab, then scroll to Chained method calls
.转到Settings
-> Editor
-> Code style
-> Java
并选择Wrapping and Braces
选项卡,然后滚动到Chained method calls
。 Check the little combo on the right of the item, default Do not wrap
, and change it to Wrap always
.检查项目右侧的小组合,默认为Do not wrap
,并将其更改为Wrap always
。
Depending on your prefference, you may want to also consider the next Align when multiline
checkbox根据您的喜好,您可能还需要考虑下一个Align when multiline
复选框
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.