在 Visual Studio 代码中插入带有键绑定的代码

Inserting code with a keybinding in Visual Studio Code

如何使用键绑定在 Visual Studio MacOS 代码中插入代码?例如在 Sublime 中我可以像这样插入一个 console.log

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

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

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

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