{ "key": "ctrl+k m",
"command": "workbench.action.editor.changeLanguageMode" },
基于上面触发“选择语言模式”下拉菜单的默认键绑定,我假设我应该能够在自定义 keybindinds.json 字符串中传递另一个参数(或细化“命令”字符串)以强制选择特定语言的语法文件。
在 SublimeText 3 中,我用于切换到 SQL 语法突出显示的自定义 .json 键绑定如下所示:
{"keys": ["alt+s"], "command": "set_file_type",
"args": {"syntax": "Packages/SQL/SQL.sublime-syntax"}}
我可以传入什么附加参数来强制workbench.action.editor.changeLanguageMode
选择特定的语言标识符?
https://code.visualstudio.com/docs/languages/identifiers https://code.visualstudio.com/docs/languages/identifiers
https://github.com/Microsoft/vscode/blob/2e2b47a4944ad1dfc7bbc58756c91aa3188cfa04/src/vs/workbench/browser/parts/editor/editorStatus.ts https://github.com/Microsoft/vscode/blob/2e2b47a4944ad1dfc7bbc58756c91aa3188cfa04/src/vs/workbench/browser/parts/editor/editorStatus.ts
看来目前无法直接设置文件的语言。这workbench.action.editor.changeLanguageMode
命令不带任何参数,而是使用快速选择器在初始命令调用后获取语言(github https://github.com/Microsoft/vscode/blob/8da5b22/src/vs/workbench/browser/parts/editor/editorStatus.ts#L749)。扩展程序也没有办法对此进行操作。
这是一个相关问题 https://github.com/Microsoft/vscode/issues/1800要求将其公开给 API。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)