Home > OS >  IntelliJ IDEA Java formatter, how to not allow blank lines after opening braces?
IntelliJ IDEA Java formatter, how to not allow blank lines after opening braces?

Time:08-31

I've searched existing questions and IDEA formatter options but to no avail, I can not for the life of me figure out how to prevent these sorts of blank lines after the braces:

public void foo() {

   int x = 0;
   if {

      int y = 0;
   }
}

I know I can get rid of ALL blank lines in the code body by specifying maximum lines in "code" to be 0 but that's not what I want.

Any help appreciated :)

CodePudding user response:

I don't know about the if, but for the method body, it might be:

Preferences > Editor > Code Style > Java > Blank Lines > Before method body > 1

screenshot

CodePudding user response:

in your IDE file->settings->code style->java. then select Blank Lines tab and change Before Method Body.

  • Related