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 中创建日期的正确方法是什么? 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 大摇大摆的枚举 2022-01-01