在
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在Java模式下将重新格式化上述行,但只有当它们是/ * * / – 样式注释时.它会缩短//太长的行,但是它不会连接在一起太短的行.
您可能需要配置Java格式化程序以包含注释.
首选项 – > Java – >代码样式 – > Formatter – >编辑… – >注释
确保启用“启用XXX注释格式”.