src/vs/workbench/api/browser/mainThreadLanguages.ts/MainThreadLanguages/$changeLanguage
class MainThreadLanguages:	async $changeLanguage(resource: UriComponents, languageId: string): Promise<void> {

		const languageIdentifier = this._modeService.getLanguageIdentifier(languageId);
		if (!languageIdentifier || languageIdentifier.language !== languageId) {
			return Promise.reject(new Error(`Unknown language id: ${languageId}`));
		}

		const uri = URI.revive(resource);
		const ref = await this._resolverService.createModelReference(uri);
		try {
			this._modelService.setMode(ref.object.textEditorModel, this._modeService.create(languageId));
		} finally {
			ref.dispose();
		}
	}