Eclipse auto-formatter, disable auto line-wrapping of comment lines

后端 未结 2 907
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-05 03:14

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:

pri         


        
相关标签:
2条回答
  • 2021-02-05 03:23

    This annoys me also. To fix the wrapped comments you can use the keyboard shortcut CTL+ALT+J to join the comments onto one line. The comment-indicator characters (// or *) will still be there but at least it will save you some steps. Then you can just run a find and replace for the comment-indicators.

    0 讨论(0)
  • 2021-02-05 03:49

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

    • 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.

    0 讨论(0)
提交回复
热议问题