且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Eclipse中配置自动格式化?

更新时间:2022-10-15 07:42:37

转到 Windows - > 首选项,在选项表中选择 Java - > >首选项菜单,您可以输入搜索字词来查找该词条的所有选项,因此只需进入首选项菜单并输入格式即可显示所有选项


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?

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