Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/keybindings-vscode.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ To add a keybinding for the **Wrap Comment / Text at column...** command, use it
}
```

### Unwrap command ###
To add a keybinding for the **Unwrap Comment / Text** command, use its `rewrap.unwrapComment` id:
```json5
{
"key": "alt+shift+q", "command": "rewrap.unwrapComment"
}
```

### Auto-wrap command ###
To add a keybinding for the auto-wrap toggle, use the command ID `rewrap.toggleAutoWrap`.

Expand Down
4 changes: 4 additions & 0 deletions vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
"command": "rewrap.rewrapComment",
"title": "Rewrap Comment / Text"
},
{
"command": "rewrap.unwrapComment",
"title": "Unwrap Comment / Text"
},
{
"command": "rewrap.rewrapCommentAt",
"title": "Rewrap/Unwrap Text At Column..."
Expand Down
7 changes: 7 additions & 0 deletions vscode/src/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ async function activate(context) {
// Register the commands
context.subscriptions.push
( commands.registerTextEditorCommand('rewrap.rewrapComment', rewrapCommentCommand)
, commands.registerTextEditorCommand('rewrap.unwrapComment', unwrapCommentCommand)
, commands.registerTextEditorCommand('rewrap.rewrapCommentAt', rewrapCommentAtCommand)
, commands.registerTextEditorCommand('rewrap.toggleAutoWrap', autoWrap.editorToggle)
)
Expand All @@ -23,6 +24,12 @@ async function activate(context) {
doWrap(editor).then(() => saveDocState(getDocState(editor)))
}

/** Unwrap command */
function unwrapCommentCommand(editor)
{
doWrap(editor, 0).then(() => saveDocState(getDocState(editor)))
}

let customWrappingColumn = 0;
/** Does a rewrap, but first prompts for a custom wrapping column to use. */
async function rewrapCommentAtCommand(editor)
Expand Down