Home > OS >  Can I make IntelliJ's Java formatter separate blocks of fields with the same visibility by a bl
Can I make IntelliJ's Java formatter separate blocks of fields with the same visibility by a bl

Time:12-18

I use IntelliJ's formatter to format my Java code. My settings include IntelliJ's defaults to rearrange fields depending on their visibility. For example, this will place public before protected before private class members:

Before:

protected int g;
private int x;
public int a;

After:

public int a;
protected int g;
private int x;

Is there a possibility to make IntelliJ add a blank line in between blocks of fields with the same visibility? I.e.

Intended after:

public int a;

protected int g;

private int x;

I found the option to insert "section rules" that allow me to specify comments to enter before and after sections. However, that settings won't let me enter something non-commenty, i.e. if I leave the field blank it will turn it into //, and if I enter something like \n, it will turn it into //\n. So this does not serve blank lines.

CodePudding user response:

It's not possible at the moment, feel free to vote for the corresponding feature request.

  • Related