以下代码来自 playframework-2.0 的示例:
/**
* Display the dashboard.
*/
public static Result index() {
return ok(
dashboard.render(
Project.findInvolving(request().username()),
Task.findTodoInvolving(request().username()),
User.find.byId(request().username())
)
);
}
看起来不错,但是当我使用eclipse的代码格式时,它变成:
/**
* Display the dashboard.
*/
public static Result index() {
return ok(dashboard.render(
Project.findInvolving(request().username()),
Task.findTodoInvolving(request().username()),
User.find.byId(request().username())
));
}
如何配置 Eclipse 以保持第一种格式样式?我尝试了很多,但没有效果。
你必须使用Code Formatter
在日食中。您可以在以下路径中找到它:
-
windows
菜单和在Preferences
item.
- go to
java
在左边的树中。
- go to
code style
的子树java
.
- select
Formatter
leaf.
- click
Edit
按钮并编辑您的自定义格式并保存。
我建议您保存自定义环境(例如格式化程序)并在其他地方使用它。Eclipse
hold formatter
xml 文件中的信息。您可以指定该文件的路径。
以下链接很有用:
- http://www.peterfriese.de/formatting-your-code-using-the-eclipse-code-formatter/ http://www.peterfriese.de/formatting-your-code-using-the-eclipse-code-formatter/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)