[英]detect file extension in vscode
我同时进行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('',)
{
"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',)"
}
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.