Reputation: 625
An example:
I'm sick of writing $log.debug(myWord);
Is there any way in VSCode I can double click myWord
to highlight it and hit a binded key or run a command that inserts $log.debug(
before and );
after?
Upvotes: 2
Views: 1020
Reputation: 13468
Out of the box and in addition to what you are looking for: You can select some text or multiple lines of text and while it is highlighted press one of the following characters to have it wrapped with the character plus the corresponding closing character. Please edit this answer if you know of any others:
I don't know what this feature is called, if I did we might be able to find the VSCode docs and link them here.
Upvotes: 0
Reputation: 625
This was solved by opening up "Open Keyboard Shortcuts (JSON)" via ctrl+shift+p and adding the following item:
[
{
"key": "alt+shift+e",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "\\$log.error(\"${TM_SELECTED_TEXT}\", $TM_SELECTED_TEXT$1);"
}
}
]
Upvotes: 2