Vla*_*rSD 13 visual-studio-code
我知道您可以输入带有代码片段的文本块,但是您可以配置键盘快捷键来输入一些文本吗?使用“editor.action”,您可以移动光标,但我无法确定是否可以让它输入一些文本。
像Ctrl+Enter这样的东西是 "); 然后换行
也许创建一个代码片段,然后使用键盘快捷键调用它?
有没有办法找到“editor.action”的所有选项?
Ale*_*lex 21
您可以在按键上插入用户代码段:
打开 keybindings.json (Preferences: Open Keyboard Shortcuts (JSON)),它定义了你所有的键绑定,并添加一个键绑定传递“snippet”作为额外的参数
{
"key": "ctrl+enter",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "\");\n$0"
}
}
Run Code Online (Sandbox Code Playgroud)
此外,您可以指定它应该使用的语言:
"when": "editorTextFocus && editorLangId == 'javascript'"
Run Code Online (Sandbox Code Playgroud)
请参阅此处了解更多信息。
您还可以type在键绑定中使用简单命令,例如:
{
"key": "ctrl+enter",
"command": "type",
"args": {
"text": "myText"
},
"when": "editorTextFocus"
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4137 次 |
| 最近记录: |