在 IntelliJ 中控制 Java 多行方法调用中的缩进
IntelliJ似乎只有两种多行方法调用参数的配置。它们要么看起来像这样:
或者这样:
这是使用“编辑器 -> 代码样式 -> Java -> 包装”来控制的和大括号 -> 方法调用参数 -> 多行对齐”选项。但是,我还没有找到任何设置来实现我实际首选的格式,如下:
如果在编辑器中按退格键没有删除整个换行符,而不仅仅是删除,那就不会那么令人恼火了这选项卡,但最好我希望能够控制使用多少个选项卡,即仅比方法调用声明本身多一个。对此的任何帮助将不胜感激。
IntelliJ seems to only have two configurations for multiline method call parameters. They either appear like this:
Or this:
This is controlled using the "Editor -> Code Style -> Java -> Wrapping and Braces -> Method call arguments -> Align when multiline" option. However, I have not found any settings to achieve my actual preferred formatting, this:
That would not be quite as infuriating if pressing backspace in the editor didn't delete the entire line break, instead of just the tabs, but preferably I'd like to be able to control how many tabs are used, i.e. only one more than the method call declaration itself. Any help towards this would be enormously appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您正在寻找的是“继续缩进”(编辑器 -> 代码样式 -> 制表符和缩进 -> 继续缩进。当禁用“多行对齐”时,它使用此缩进大小(并且它看来您的默认值是 8)。
当我使用此设置重新格式化时,我得到:
I believe what you're looking for is the "Continuation Indent" (Editor -> Code Style -> Tabs and Indents -> Continuation Indent. When "Align when multiline" is disabled, it uses this indent size (and it appears that you have the default of 8).
When I reformat with this setting I get: