IDE中是否有任何工具可以自动修复注释格式?

Fra*_*rth 7 eclipse ide comments netbeans visual-studio

/* Suppose I have a multi-line comment with hard line-breaks
 * that are roughly uniform on the right side of the text,
 * and I want to add text to a line in order to make the
 * comment a bit more descriptive.
 */
Run Code Online (Sandbox Code Playgroud)

现在,最不幸的是,我需要在其中一个行添加文本.

/* Suppose I have a multi-line comment with hard line-breaks (here is some added text for happy fun time)
 * that are roughly uniform on the right side of the text,
 * and I want to add text to a line in order to make the
 * comment a bit more descriptive.
 */
Run Code Online (Sandbox Code Playgroud)

它需要O(n)时间(n是行数)来固定每一行,以便它们大致排成一行.电脑应该这样做,而不是我.

我们的IDE中是否有工具可以解决这个问题?他们叫什么?

Ale*_*x B 4

emacs 支持fill-paragraph通常映射到meta-q.

fill-paragraph第二段文本的输出:

/* Suppose I have a multi-line comment with hard line-breaks (here is
 * some added text for happy fun time) that are roughly uniform on the
 * right side of the text, and I want to add text to a line in order
 * to make the comment a bit more descriptive.
 */
Run Code Online (Sandbox Code Playgroud)