src/vs/editor/browser/widget/codeEditorWidget.ts/CodeEditorWidget/setModel
class CodeEditorWidget:	public setModel(_model: ITextModel | editorCommon.IDiffEditorModel | null = null): void {
		const model = <ITextModel | null>_model;
		if (this._modelData === null && model === null) {
			// Current model is the new model
			return;
		}
		if (this._modelData && this._modelData.model === model) {
			// Current model is the new model
			return;
		}
		const hasTextFocus = this.hasTextFocus();
		const detachedModel = this._detachModel();
		this._attachModel(model);
		if (hasTextFocus && this.hasModel()) {
			this.focus();
		}

		const e: editorCommon.IModelChangedEvent = {
			oldModelUrl: detachedModel ? detachedModel.uri : null,
			newModelUrl: model ? model.uri : null
		};

		this._removeDecorationTypes();
		this._onDidChangeModel.fire(e);
		this._postDetachModelCleanup(detachedModel);

		this._contributions.onAfterModelAttached();
	}