在Eclipse PDT中,使用Ctrl-Shift-F可以重新格式化代码。但是它不会修改任何注释。是否有一种方法可以将不规则的多行注释重新格式化为每行80个字符(或任何其他长度)?
即转换:
即转换:
// We took a breezy excursion and
// gathered Jonquils from the river slopes. Sweet Marjoram grew
// in luxuriant
// profusion by the window that overlooked the Aztec city.
至
// We took a breezy excursion and gathered Jonquils
// from the river slopes. Sweet Marjoram grew in
// luxuriant profusion by the window that overlooked
// the Aztec city.
我认为这也适用于普通的Eclipse。
更新 结果发现在Java
模式下,Eclipse
将重新格式化上面的行,但只限于/* */风格的注释。它会缩短过长的//行,但不会将太短的行连接在一起。