[英]Wrap a highlighted string in custom text in VSCode
An example:一个例子:
I'm sick of writing $log.debug(myWord);
我厌倦了写$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 );
在 VSCode 中有什么方法可以双击myWord
以突出显示它并点击绑定键或运行插入$log.debug(
before and );
的命令after?后?
This was solved by opening up "Open Keyboard Shortcuts (JSON)" via ctrl+shift+p and adding the following item:通过 ctrl+shift+p 打开“Open Keyboard Shortcuts (JSON)”并添加以下项目解决了这个问题:
[
{
"key": "alt+shift+e",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "\\$log.error(\"${TM_SELECTED_TEXT}\", $TM_SELECTED_TEXT$1);"
}
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.