Eclipse的Java格式化程序缩进可以换行与新块不同吗? [英] Can Eclipse's Java formatter indent wrapped lines differently than new blocks?

查看:187
本文介绍了Eclipse的Java格式化程序缩进可以换行与新块不同吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢这样格式化我的代码:

I like to format my code like this:

void someFunction() {
   normalLine();
   reallyLongLineThatNeedsToBeWrapped(
    OnlyIndentOneSpaceHere = true);
   normalLine();
}

但是,从我的Eclipse源代码格式的实验看来,指定独立于新块缩进的换行缩进。

But from my experimenting with Eclipse's source formatting, it seems that you can't specify wrapped line indentation independently from new block indentation.

有没有办法在Eclipse中完成这个?

Is there a way to accomplish this in Eclipse?

根据答案,我提交了 Eclipse增强请求

推荐答案

我不这么认为。问题是您不能根据上下文将缩进大小更改为不同。所以选择1为缩进大小导致一切缩进一个空格。您可以根据它作为函数调用来创建单独的包装策略,但如果是函数调用,缩进的单位不能更改。

I don't think so. The problem is you can't change the indentation size to be different depending on context. So choosing 1 for the indentation size results in everything being indented by one space. You can have a separate wrapping policy based on it being a function call or not, but the "units" of indentation can't change if it's a function call.

这篇关于Eclipse的Java格式化程序缩进可以换行与新块不同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆