Eclipse自动格式化,禁用注释行的自动换行 [英] Eclipse auto-formatter, disable auto line-wrapping of comment lines

查看:3072
本文介绍了Eclipse自动格式化,禁用注释行的自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢eclipse自动格式化,但是有一个功能让我疯狂地疯狂:

I love eclipse auto formatting, but there's one feature that's driving me raging mad:

由于我在自动格式化中使用换行符,代码如下:

Since I use wrap-lines in my auto-formmatter, code like this:

private static Location                         _location           = null; // this is a comment

变成可怕的可怕代码:

private static Location                         _location           = null;                 // this
                                                                                                    // is
                                                                                                    // a
                                                                                                    // comment

这不仅是痛苦的观察,但不是一切便于更换...

this is not only painful to watch, but not at all convenient to change back...

有什么办法删除线条换行为评论,或至少修复它看起来不是一个绝对的混乱?

Is there any way to remove line-wrapping for comments, or at least fix so it doesn't look like an absolute mess?

谢谢

推荐答案

我认为你特意询问你的事情可以通过编辑你的格式化程序来实现:

I think that the thing you are specifically asking about you can achieve by editing your formatter:


  • 窗口 - > 首选项 - > Java - > 代码样式 - > Formatter 。编辑您点击编辑...

  • 如果您使用的是默认的Eclipse格式化程序,则需要编辑配置文件名称

  • 转到评论

  • 取消选择行评论格式。

  • Window -> Preferences -> Java -> Code Style -> Formatter. There edit you click on Edit...
  • If you are using the default Eclipse formatter you will need to edit the profile name (you cna not edit built in profile).
  • Go to comments
  • Deselect line comment formatting.

这样就不会格式化类型 // 的注释。

That way no formatting of comments of the type // will be done.

这篇关于Eclipse自动格式化,禁用注释行的自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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