我同时执行python和节点编码。我在Visual Studio Code中有一个用于console.log()的键绑定。
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "console.log('$0',)"
}
}
我想要同样的快捷方式来检测.py
扩展名并打印print('',)
并检测.js, .ts
文件扩展名并打印console.log('',)
答案 0 :(得分:0)
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == javascript",
"args": {
"snippet": "console.log('$0',)"
}
},
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == typescript",
"args": {
"snippet": "console.log('$0',)"
}
},
{
"key": "ctrl+shift+l",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus && editorLangId == python",
"args": {
"snippet": "print('$0',)"
}
},