VS Code:重新包装文本或注释块

Jo *_*iss 17 visual-studio-code

如何重新包装文本块或长注释以容纳 80 列?

我不希望它只呈现自动换行(这可以通过 Edit -> Toggle Word Wrap 或 setting 轻松实现"editor.wordWrap": "on"),但我希望它实际插入硬换行符。此功能在某些编辑器中称为“填充段落”。

例如:

// This is a very long comment. I would like for this comment to occupy multiple lines rather than a single line, so that it is easy to read for other people.
Run Code Online (Sandbox Code Playgroud)

现在我想按一些键来获得:

// This is a very long comment. I would like for this comment to occupy
// multiple lines rather than a single line, so that it is easy to read for
// other people.
Run Code Online (Sandbox Code Playgroud)

Cap*_*ack 12

看起来Rewrap 可以满足您的需求。不确定是否有本地方式。他们仍在添加许多功能。


the*_*rns 6

VSCodeVim支持这个特性。只需选择一个文本块并按gq。:)