[英]Eclipse Java formatter: blank lines
i am trying to adjust the code formatter settings in eclipse to my wishes. 我试图根据自己的意愿调整Eclipse中的代码格式化程序设置。
That is my (unformatted) example code: 那是我的(未格式化的)示例代码:
public class Test {
/**
* Test 1.
*/
public void test() {
System.out.println("Blub");
}
/**
* Test 2.
*/
public void test2() {
System.out.println("Blub");
}
}
After formatting (eclipse standard settings) the code looks like this: 格式化(Eclipse标准设置)后,代码如下所示:
public class Test {
/**
* Test 1.
*/
public void test() {
System.out.println("Blub");
}
/**
* Test 2.
*/
public void test2() {
System.out.println("Blub");
}
}
I tried everything to adjust the formatter settings to get this result: 我尝试了所有调整格式设置的方法,以获得以下结果:
Add a blank before the first java doc comment. 在第一个Java文档注释之前添加一个空格。
Remove the last blank line (before the closing braces of the class declaration). 删除最后一个空行(在类声明的大括号之前)。
How can i achieve this or is it not possible to configure this in eclipse? 我怎样才能做到这一点,还是不能在Eclipse中进行配置?
I would say it's going to be under the 'blank lines' section of the formatter settings. 我会说它将在格式设置的“空白行”部分下。
(Blank lines within class declarations) -> Before first declaration. (类声明中的空白行)->在首次声明之前。 Try setting to 1.
尝试设置为1。
(Existing blank lines) -> Number of blank lines to preserve (This is the setting where you can get Eclipse to remove blank lines in places not specified by the other rules). (现有空白行)->要保留的空白行数(这是让Eclipse在其他规则未指定的地方删除空白行的设置)。 Try setting to zero.
尝试设置为零。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.