I've been trying to find the option of inserting a blank line before the closing '}' of the class and have not found it.
My goal is to format
interface IShooter {
void incHealth(); // health++
void decHealth(); // health--
int getHealth();
}
to this
interface IShooter {
void incHealth(); // health++
void decHealth(); // health--
int getHealth();
}
There are shortcuts for this in IntelliJ IDEA! Simply hit Shift+Enter to start a new line below the current line or Ctrl+Alt+Enter (⌥⌘Enter on Mac) to start a new line above the current line.
So the easiest way to exclude your test is to create a third source folder, call it /ignore, and not mark it as a source folder in IntelliJ. You can then drop any file you don't want to include in your compilation there temporarily, and drag it back to its original folder when you want to continue working on it.
This is not possible with stock IntelliJ. If you open up Preferences > Editor > Code Style > Java and then click the Blank Lines Tab. you can see a list of options.
As you can see, there is an option for Maximum Blank Lines Before '}' but unfortunately not for Minimum Blank Lines.
UPDATE:
"Before class end" option was added to "Minimum Blank Lines".
Available since 2018.2 - Youtrack Ticket
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With