Search code examples
vscode-extensions

How to change language mode programmatically via VS Code extension API?


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.


Solution

  • Currently this is not possible. Here is the corresponding issue on GitHub. You should upvote (thumbs up) it to tell them we want this.