src/vs/workbench/browser/parts/editor/textEditor.ts/BaseTextEditor/computeEditorViewState
class BaseTextEditor:	protected override computeEditorViewState(resource: URI): T | undefined {
		const control = this.getControl();
		if (!isCodeEditor(control)) {
			return undefined;
		}

		const model = control.getModel();
		if (!model) {
			return undefined; // view state always needs a model
		}

		const modelUri = model.uri;
		if (!modelUri) {
			return undefined; // model URI is needed to make sure we save the view state correctly
		}

		if (!isEqual(modelUri, resource)) {
			return undefined; // prevent saving view state for a model that is not the expected one
		}

		return withNullAsUndefined(control.saveViewState() as unknown as T);
	}