Reputation: 5500
I have tried vscode.commands.executeCommand('workbench.action.editor.changeLanguageMode', 'JSON');
. But it does nothing more than open a panel. And TextDocument.languageId
is an readonly property.
Upvotes: 6
Views: 1199
Reputation: 67591
It was implemented at some point (1.28.0+ probably):
vscode.languages.setTextDocumentLanguage(activeEditor.document, languageId);
Upvotes: 5