如何在Eclipse PDT中重新格式化多行注释? [英] How to reformat multi-line comments in Eclipse PDT?
问题描述
在 Eclipse PDT
, Ctrl-Shift-F
重新格式化代码。但是,它根本不修改注释。有什么方法可以将粗糙的多行注释重新格式化为每行80个字符(或任何)?
In Eclipse PDT
, Ctrl-Shift-F
reformats code. However, it doesn't modify comments at all. Is there some way to reformat ragged multi-line comments to 80 characters per line (or whatever)?
转换
// 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。)
(I think this applies to regular Eclipse as well.)
更新证明 Java
模式中的 Eclipse
行,但只有当它们是/ * * / - 样式注释。
Update Turns out that Eclipse
in Java
mode will reformat the lines above, but only if they're /* */-style comments. It will shorten // lines that are too long, but it won't join lines that are too short together.
推荐答案
你会
首选项 - > Java - >代码样式 - >格式化 - >编辑... - >注释
Preferences -> Java -> Code Style -> Formatter -> Edit... -> Comments
确保已启用启用XXX评论格式。
Make sure that "Enable XXX comment formatting" is enabled.
这篇关于如何在Eclipse PDT中重新格式化多行注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!