如何修改Eclipse代码格式? [英] How do I modify Eclipse code formatting?

查看:199
本文介绍了如何修改Eclipse代码格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  public void myMethod(String param){

到这样的方法头:

  public void myMethod(
String param){

我被带到这里,我以前从来没有使用Eclipse,我导入了别人提供的项目设置。我已经看到,在Eclipse上进行的小型新项目中,并没有这样做,因此它必须在导入的设置中。但是我经历了每个可以找到的面板,以及我在工作空间中可以找到的每个隐藏文件,我无法确定是什么原因导致的。



如何关闭它?我不想在我的方法签名中的参数之前加上换行符,我无法想象为什么有人会!

解决方案

窗口> 首选项> Java > 代码样式> 格式化程序



您可以配置几乎所有内容。您的案例位于



行包装> 方法声明> 参数


When I reformat code with Eclipse, it turns method headers like this:

public void myMethod(String param) {

into method headers like this:

public void myMethod(
                     String param) {

When I was brought on here I'd never used Eclipse before, and I imported project settings provided by someone else. I have seen that on small new projects I've worked on Eclipse does not do this, so it must be in the settings I've imported. But I've gone through every panel I can find, as well as every hidden file I can find in the workspace, and I can't figure out what is causing this.

How do I turn it off? I don't want a newline before parameters in my method signatures, and I can't imagine why anyone would!

解决方案

Have a look at Window>Preferences>Java>Code Style>Formatter.

There you can configure almost everything. Your case is found at

Line Wrapping>Method Declarations>Parameters.

这篇关于如何修改Eclipse代码格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆