In 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.
to
// 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。)
Update事实证明Eclipse
in Java
mode 将重新格式化上面的行,但前提是它们是 /* */ 样式的注释。 // 它会缩短太长的行,但不会将太短的行连接在一起。
您可能需要配置 Java 格式化程序以包含注释。
首选项 -> Java -> 代码样式 -> 格式化程序 -> 编辑... -> 注释
确保“启用 XXX 评论格式”已启用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)