Skip to content
Steve Baker edited this page Feb 15, 2021 · 3 revisions
Documentation has been moved to https://stkb.github.io/Rewrap. This wiki is no longer maintained and may be out of date.

This page gives a brief overview of features.

Put the text cursor in a comment block and hit Alt+Q to re-wrap the contents to the column that's been specified in settings.

// Starts the Foo that                       
// has the        ¦
// given id.      ¦
void StartFoo(int id) {

// Starts the Foo ¦                          
// that has the   ¦
// given id.      ¦
void StartFoo(int id) {

The contents of comments is parsed as Markdown, so you can use lists, code samples (which are untouched) etc.

/// Takes up to n characters from the¦string.
/// * If n > str.length,             ¦
///   the whole string is returned.  ¦
/// * If n < 0, characters are taken from 
/// the end of the string.           ¦
///                                  ¦
/// Examples:                        ¦
///                                  ¦
///     takeChars(2, "Simple") // "Si"
///     takeChars(-3, "Fidget") // "get"
String takeChars(int n, String str) {¦

/// Takes up to n characters from the¦       
/// string.                          ¦
/// * If n > str.length, the whole   ¦
///   string is returned.            ¦
/// * If n < 0, characters are taken ¦
///   from the end of the string.    ¦
///                                  ¦
/// Examples:                        ¦
///                                  ¦
///     takeChars(2, "Simple") // "Si"
///     takeChars(-3, "Fidget") // "get"
String takeChars(int n, String str) {¦

Doc-comments with tags are no problem either.

/**                                  ¦
 * Creates a new pair of shoes with the given
 * size and color.                   ¦
 * @constructor                      ¦
 * @param {Number} size - The        ¦
 * shoe size (European).             ¦
 * @param {SHOE_COLORS} color - The  ¦
 * shoe color. Must be a {@link SHOE_COLORS}.
 */                                  ¦
function Shoe(size, color) {         ¦

/**                                  ¦       
 * Creates a new pair of shoes with  ¦
 * the given size and color.         ¦
 * @constructor                      ¦
 * @param {Number} size - The shoe   ¦
 * size (European).                  ¦
 * @param {SHOE_COLORS} color - The  ¦
 * shoe color. Must be a             ¦
 * {@link SHOE_COLORS}.              ¦
 */                                  ¦
function Shoe(size, color) {         ¦

Rewrap also works with Markdown or LaTeX files, or any plain text document.

Selections

If you select just a couple of lines, only those lines will be processed.

In VSCode you can use multiple selections (alt+click) to select multiple comment blocks or line ranges.

However you can safely select a large line range with multiple comments and code, and only the comments will be processed (the code is untouched). You can Ctrl+A, Alt+Q to re-wrap a whole document at once.


More information on the specifics is available here.

In general everything should just work as expected, so if it doesn't, please file an issue!