How to programmatically change the language mode of VSCode?

I have tried vscode.commands.executeCommand('workbench.action.editor.changeLanguageMode', 'JSON');. But this is nothing more than opening a panel. And TextDocument.languageId- the readonly property.

+4
source share
2 answers

This is currently not possible. Here is the corresponding issue on GitHub. You have to transfer (preview) to tell them that we want this.

+1
source

This was implemented at some point ( 1.28.0 +, probably):

vscode.languages.setTextDocumentLanguage(activeEditor.document, languageId);
0
source

Source: https://habr.com/ru/post/1658594/


All Articles