VS Code鍵入console.log快捷鍵

File->Preference->Keyboard Shortcuts

按右上角Open Keyboard Shortcuts (JSON)按鍵

Windows或linux加入以下代碼

[
  {
    "key": "ctrl+shift+l",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": {
      "snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
    }
  },
]

 

MacOS加入以下代碼

Windows或linux加入以下代碼

[
  {
    "key": "cmd+shift+l",
    "command": "editor.action.insertSnippet",
    "when": "editorTextFocus",
    "args": {
      "snippet": "console.log('${TM_SELECTED_TEXT}$1')$2;"
    }
  },
]