Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure autoformatting in Eclipse?

I dislike how auto format messes up empty cycle body, like:

Before

for (int i = 0; isTest(i); i++); 

After

for (int i = 0; isTest(i); i++)
    ;

How to configure eclipse not to do this?

like image 213
Margus Avatar asked Sep 08 '09 08:09

Margus


People also ask

How do I turn on auto format in Eclipse?

To format your whole script: Open the required file. Go to Source | Format Document or press Ctrl+Shift+F.

Does Eclipse have auto format?

Importing preferences for automatic formatting. Eclipse has the capability to do so some automatic formatting whenever a file that is being edited is saved.


1 Answers

Go to Windows -> Preferences, and in the options table select Java -> Code Style -> Formatter, then configure to your hearts content.

For future reference, in the Preferences menu you can just type in a search term to find all options for that term - so just going onto the Preferences menu and typing "format" will show you all options

like image 156
tddmonkey Avatar answered Sep 19 '22 14:09

tddmonkey