Eclipse formatter to keep One-Liners

自闭症网瘾萝莉.ら 提交于 2019-12-21 13:46:13

问题


Can Eclipse Formatter be configured to keep:

public Long getId() { return this.id; }

And maybe to format small (one line) definitions as one-liners?


回答1:


No: bug 205973 has been written to request such a formatter option.
3 years later, it doesn't seem likely to be implemented.


Edit May 2001:

maleki mentions, in response to orbfish's comment, that at least you have some control over the zones of code which Eclipse may or may not format:

Java development user guide > Reference > Java Editor > Formatter Help page

This isn't a direct answer, but it can help:




回答2:


To my knowledge (and after a quick look), the default formatter does not provide this level of granularity for customization. If it's that important to the business, you might be able to find an Eclipse plugin (perhaps commercial) that can be configured with advanced rules like this.



来源:https://stackoverflow.com/questions/2878577/eclipse-formatter-to-keep-one-liners

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!