我正在尝试创建一个按键绑定,以将当前的文本文档语言更改为JSON。这是我正在尝试的:
{
"key": "ctrl+alt+j",
"command": "vscode.languages.setTextDocumentLanguage",
"args": {"document":"active_doc", "languageId": "json"}
}
VSCode说
command 'vscode.languages.setTextDocumentLanguage' not found
我知道这是一个函数而不是命令,因此语法必须不同。有没有办法调整我的语法以使其正常工作,或者有扩展名可以使该工作正常? 预先感谢
Here is an example of the function being called in JavaScript from another extension
Similar question posted prior to the creation of the function I am trying to access
答案 0 :(得分:0)
有一个扩展功能,可通过按键绑定更改活动编辑器的语言:
{
"key": "ctrl+shift+8",
"command": "changeLanguageMode.change",
"args": "typescript"
}
https://marketplace.visualstudio.com/items?itemName=usernamehw.change-language-mode