问题描述
我喜欢这样格式化我的代码:
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?
根据答案,我提交了。
推荐答案
我不这么认为。问题是您不能根据上下文将缩进大小更改为不同。所以选择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格式化程序缩进可以换行与新块不同吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!