最好的Eclipse代码格式化程序? [英] Best Eclipse Code Formatters?

查看:165
本文介绍了最好的Eclipse代码格式化程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如: hello.show()。x() .y()将奇怪地格式化为 x() .y() ,并放在单独的一行。



有没有其他基本的格式化程序可以做得更好?



示例和链接非常受欢迎。

解决方案

Eclipse中的格式化程序 Java公约并更改选项卡策略,以始终使用空格而不是Tab或混合选项卡和空格。有时我也将行宽度改为100或120(我的显示器中80个字符太窄)。



关于您的具体要求:是的,您可以更改此行为。转到Formatter首选项并创建自己的配置文件。修改它在选项卡上换行并取消选中首选包装外部表达式(在一行上保留嵌套表达式)



更多信息: https://bugs.eclipse.org/bugs/show_bug.cgi? id = 313524


The default Eclipse formatter formats my Java code in a really funny way.

For example: hello.show().x().y() would oddly be formatted as x() and .y(), and be placed on a separate line.

Are there any other basic formatters that can do a better job?

Examples and links are very welcome.

解决方案

I always change the formatter in Eclipse to Java Convention AND change the tab policy to always use space instead of tab or mixing of tab and space. Sometime I change also the line width to be 100 or 120 (80 characters is just too narrow in my monitor).

Regarding your specific request: yes you can change this behavior. Go to the Formatter preference and create your own profile. Modify it on tab Line Wrapping and uncheck Prefer wrapping outer expressions (keep nested expression on one line).

More information on: https://bugs.eclipse.org/bugs/show_bug.cgi?id=313524

这篇关于最好的Eclipse代码格式化程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆