【发布时间】:2010-09-13 01:09:38
【问题描述】:
在Eclipse PDT、Ctrl-Shift-F 中重新格式化代码。但是,它根本不修改 cmets。有没有办法将参差不齐的多行 cmets 重新格式化为每行 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 模式下会重新格式化上面的行,但前提是它们是/* */-style cmets。它将缩短 // 太长的行,但不会将太短的行连接在一起。
【问题讨论】:
-
这些实际上是单行 cmets。多行 cmets 始终使用 /*-notation。
-
我认为他的意思是跨越多个单行 cmets 的评论。这类事情是在 Python 中进行除文档字符串之外的任何类型注释的典型方式。
标签: php eclipse comments eclipse-pdt reformat