如何在 Eclipse 中配置自动格式化?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1392744/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I configure autoformatting in Eclipse?
提问by Margus
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?
如何配置eclipse不这样做?
回答by tddmonkey
Go to Windows-> Preferences, and in the options table select Java-> Code Style-> Formatter, then configure to your hearts content.
转到Windows-> Preferences,然后在选项表中选择Java-> Code Style-> Formatter,然后根据您的喜好进行配置。
For future reference, in the Preferencesmenu you can just type in a search term to find all options for that term - so just going onto the Preferencesmenu and typing "format" will show you all options
为了将来参考,Preferences您可以在菜单中输入搜索词以查找该词的所有选项 - 因此只需进入Preferences菜单并输入“格式”即可显示所有选项