Best Eclipse Code Formatters?(最好的 Eclipse 代码格式化程序?)
问题描述
默认的 Eclipse 格式化程序以一种非常有趣的方式格式化我的 Java 代码.
The default Eclipse formatter formats my Java code in a really funny way.
例如:hello.show().x().y()
会奇怪地被格式化为 x()
和 .y()
,并放在单独的一行.
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.
推荐答案
我总是将 Eclipse 中的格式化程序更改为 Java Convention 并将选项卡策略更改为始终使用空格而不是选项卡或混合选项卡和空间.有时我还将线宽更改为 100 或 120(80 个字符在我的显示器中太窄了).
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).
关于您的具体要求:是的,您可以更改此行为.转到格式化程序首选项并创建您自己的配置文件.在选项卡 Line Wrapping 上修改它并取消选中 Prefer wrapping external expressions (keep nested expression on a line)
.
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)
.
更多信息:https://bugs.eclipse.org/bugs/show_bug.cgi?id=313524
这篇关于最好的 Eclipse 代码格式化程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:最好的 Eclipse 代码格式化程序?


- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 获取数字的最后一位 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 转换 ldap 日期 2022-01-01