在Visual Studio代码中使用键绑定插入代码

时间:2017-01-23 13:19:42

标签: visual-studio-code key-bindings vscode-settings

如何使用键绑定在Mac OS的Visual Studio代码中插入代码?例如在Sublime中,我可以像这样插入console.log

{ 
  "keys": ["super+shift+l"],
  "command": "insert_snippet",
  "args": {
    "contents": "console.log('test:' + varname);${0}"
  }
},

如果我按 Cmd + Shift + L 我得到console.log('test:' + varname);

1 个答案:

答案 0 :(得分:2)

您可以指定insertSnippet命令应该插入的内容:

{
    "key": "cmd+shift+l",
    "command": "editor.action.insertSnippet",
    "args": {
       "snippet": "console.log('test:' + varname);${0}"
    }
}