How to auto-format code in Eclipse?

425

How do you auto-format code in Eclipse?

This question is tagged with eclipse formatting format code-formatting

~ Asked on 2013-03-27 09:09:17

The Best Answer is


736

On Windows and Linux : Ctrl + Shift + F

On Mac : ? + ? + F

(Alternatively you can press Format in Main Menu > Source)

~ Answered on 2013-03-27 09:09:17


196

Another option is to go to Window->Preferences->Java->Editor->SaveActions and check the Format source code option. Then your source code will be formatted truly automatically each time you save it.

~ Answered on 2013-03-27 09:18:50


Most Viewed Questions: