How to remove unnecessary blank line on code formatting in IntelliJ?
Yes. It is possible to configure the number of blank lines in the settings menu (CTRL+ATL+S): File -> Settings -> Editor -> Code Style -> Java(or Scala or whatever your language is) -> Blank Lines
File >> Setting >> Editor >> Code style java >>Blank lines tab
You should change to 0 in code label(as picture), It would remove all unnecessary blank line when press format shortcut: ctrl + alt + L
You can find and replace with regex option also ^(?:[\t ]*(?:\r?\n|\r))+
. It searches all empty lines in file. You need to just replace it with empty