Visual Studio代码:用于将文档语法突出显示为JSON的键绑定

问题描述 投票:0回答:1

我正在尝试创建一个键绑定,以将当前文本文档语言更改为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

visual-studio-code vscode-settings
1个回答
0
投票

有一个扩展可以从键绑定更改活动编辑器的语言:

{
    "key": "ctrl+shift+8",
    "command": "changeLanguageMode.change",
    "args": "typescript"
}

https://marketplace.visualstudio.com/items?itemName=usernamehw.change-language-mode

© www.soinside.com 2019 - 2024. All rights reserved.