Eclipse 自定义格式
我正在尝试创建一个 JAVA 代码格式化程序,使其不换行。但是对于我手动包装的代码中的任何行,我希望格式化程序尊重它们而不是将它们格式化为一行。
例如:
public Class {
public Class(String a,
String b,
String c,
String d) {
// The constructor arguments should stay as they are
}
public void aMethod() {
// This statement should not be wrapped
get().doSomething().getAnohterMethodThatHasAReeeeeeeaalllyyLongName();
}
}
我将线宽设置为 9999(最大值),并且关闭了所有内容的换行。我错过了什么?
谢谢。
I'm trying to create a JAVA code formatter such that it doesn't wrap any lines. BUT for any lines in my code that I have manually wrapped I want the formatter to respect them and not format them in to one line.
For example:
public Class {
public Class(String a,
String b,
String c,
String d) {
// The constructor arguments should stay as they are
}
public void aMethod() {
// This statement should not be wrapped
get().doSomething().getAnohterMethodThatHasAReeeeeeeaalllyyLongName();
}
}
I have made the line width 9999 (the max), and I have turned off line wrapping for everything. What have I missed?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我打开了偏好页面
“Java - 代码样式 - 格式化程序”
并激活“从不连接行”
并在组合框中“换行策略”中选择“不换行”。
经过此更改,我能够编写未换行的代码。
I opened the preference page for
"Java - Code Style - Formatter"
and activated "never join lines"
and selected "Do not wrap" in the combo box "line wrapping policy"
After this change i was able to write code, which was not wrapped.