src/vs/workbench/common/editor/textEditorModel.ts/BaseTextEditorModel/updateTextEditorModel
class BaseTextEditorModel:	updateTextEditorModel(newValue?: ITextBufferFactory, preferredMode?: string): void {
		if (!this.isResolved()) {
			return;
		}

		// contents
		if (newValue) {
			this.modelService.updateModel(this.textEditorModel, newValue);
		}

		// mode (only if specific and changed)
		if (preferredMode && preferredMode !== PLAINTEXT_MODE_ID && this.textEditorModel.getModeId() !== preferredMode) {
			this.modelService.setMode(this.textEditorModel, this.modeService.create(preferredMode));
		}
	}