繁体   English   中英

在vscode中检测文件扩展名

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM