我可以让 IntelliJ 的 Java 格式化程序用一个空行分隔具有相同可见性的字段块吗?
Can I make IntelliJ's Java formatter separate blocks of fields with the same visibility by a blank line?
我使用 IntelliJ 的格式化程序来格式化我的 Java 代码。我的设置包括 IntelliJ 的默认值,以根据字段的可见性重新排列字段。例如,这会将 public
放在 protected
之前 private
class 成员之前:
之前:
protected int g;
private int x;
public int a;
之后:
public int a;
protected int g;
private int x;
是否可以让 IntelliJ 在具有相同可见性的字段块之间添加一个空行?即
计划于:
public int a;
protected int g;
private int x;
我找到了插入“部分规则”的选项,它允许我指定要在部分前后输入的评论。但是,该设置不允许我输入非注释的内容,即如果我将该字段留空,它将变成 //
,如果我输入类似 \n
的内容,它将变成//\n
。所以这不提供空白行。
目前无法完成,请随时vote for the corresponding feature request。
我使用 IntelliJ 的格式化程序来格式化我的 Java 代码。我的设置包括 IntelliJ 的默认值,以根据字段的可见性重新排列字段。例如,这会将 public
放在 protected
之前 private
class 成员之前:
之前:
protected int g;
private int x;
public int a;
之后:
public int a;
protected int g;
private int x;
是否可以让 IntelliJ 在具有相同可见性的字段块之间添加一个空行?即
计划于:
public int a;
protected int g;
private int x;
我找到了插入“部分规则”的选项,它允许我指定要在部分前后输入的评论。但是,该设置不允许我输入非注释的内容,即如果我将该字段留空,它将变成 //
,如果我输入类似 \n
的内容,它将变成//\n
。所以这不提供空白行。
目前无法完成,请随时vote for the corresponding feature request。