简体   繁体   English

如何避免Eclipse在Java中包装多行注释/*...*/?

[英]How to keep eclipse from wrapping multiline comments /*…*/ in Java?

How do I keep eclipse from wrapping multiline comments in Java when using /* ... */? 使用/ * ... * /时,如何避免eclipse用Java包装多行注释?

For example, Eclipse will take this: 例如,Eclipse将采用以下方法:

/*
// Old code, don't use
for( int i = 0; i < myarray.length(); i++){
        myarray[i].haveFun();
}
*/

And turn it into this: 并将其转换为:

/*
// Old code, don't use for( int i = 0; i <  
myarray.length(); i++){  myarray[i].haveFun();
}
*/

Eclipse formatter -> "Off/On Tags" -> Enable. Eclipse格式化程序->“关闭/开启标签”->启用。 Then use comments, for example: 然后使用注释,例如:

// @formatter:off
...
// @formatter:on

Go to Preferences > Java > Code Style > Formatter and select Edit... on the active profile. 转到Preferences > Java > Code Style > Formatter然后在活动配置文件上选择“ Edit... ”。

Switch to the Comments tab and enter a large value for the Maximum line width for comments value 切换到“ Comments选项卡,并为“ CommentsMaximum line width for comments值输入一个较大的值

http://www.wikihow.com/Change-the-Default-Format-Settings-in-Eclipse http://www.wikihow.com/Change-the-Default-Format-Settings-in-Eclipse

The article explains how to do exactly what you want and more. 本文介绍了如何准确地执行您想要的以及更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM