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.
vscode.commands.executeCommand('workbench.action.editor.changeLanguageMode', 'JSON');
TextDocument.languageId
This is currently not possible. Here is the corresponding issue on GitHub. You have to transfer (preview) to tell them that we want this.
This was implemented at some point ( 1.28.0 +, probably):
vscode.languages.setTextDocumentLanguage(activeEditor.document, languageId);
Source: https://habr.com/ru/post/1658594/More articles:column capture frequency - rHow to set context value inside http.HandleFunc? - goWhy std :: async calls a function synchronously even with the specified value std :: launch :: async - c ++Bootstrap navbar drop-down form - htmlCall the API several times until all the data has been loaded - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1658595/error-pushing-changes-to-cloud-foundry&usg=ALkJrhgiBYhUi3y4TdBa5UtN4NPGvRzj1AFlextable indent made with R-ReporteRs - ris mcrypt out of date? - How to correctly encrypt and save a password in PHP? - securityWhy doesn't my ToggleButton style work on the second tab of the TabControl? - c #JIRA REST API cors - restAll Articles