Using Eclipse is it possible (via formatter or other setting) to automatically pre-indent blank lines in Java code with the appropriate number of tabs (or whitespace)?
(Not interested in arguing about others opinion that this is a bad idea or "wastes bytes" (hahaha) or any other such nonsense - just want to know if it's possible, thanks.)
Edit: Actually this may be a problem that can be fixed with templates (I've had no success so far), but when I generate a new class I get methods like this:
@Override
public void setData(Object data) {
//No indentation on first line :(
}
The formatter, even with "Indent empty lines" checked, definitely doesn't add tabs there either. Maybe this is a bug?
5-In your Eclipse IDE, Go to: Window → Preferences → General → Editors → Text Editors → Indent Guide 6-Then enable indent guide checkbox. 7-Enjoy !
In eclipse preference setting you can remove all the unwanted blank lines. Eclipse: Window > Preferences > Java > Code Style > Formatter > Edit the formatter and following screen will pop up. And when you format the code all unwanted blank lines will be removed.
Indentation settings for Java Code style scheme settings are configured in Settings/Preferences | Editor | Code Style | Java. Use the tab or space character for indentation and code formatting.
There specify the indentation level under : Displayed Tab Width. Select the formatter and press Edit . Use whatever suits you.
Yep, you can do that. Go to Preferences/Java/Code Style/Formatter and edit your active profile. Then on the Indentation tab tick empty lines.
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