在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。)
更新结果Eclipse
in Java
mode 将重新格式化上面的行,但前提是它们是 /* */ 样式的注释。它将缩短 // 太长的线,但不会将太短的线连接在一起。