src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts/DirtyDiffWorkbenchController/onEditorsChanged
class DirtyDiffWorkbenchController:	private onEditorsChanged(): void {
		const models = this.editorService.visibleTextEditorControls

			// only interested in code editor widgets
			.filter(c => c instanceof CodeEditorWidget)

			// set model registry and map to models
			.map(editor => {
				const codeEditor = editor as CodeEditorWidget;
				const controller = DirtyDiffController.get(codeEditor);
				controller.modelRegistry = this;
				return codeEditor.getModel();
			})

			// remove nulls and duplicates
			.filter((m, i, a) => !!m && !!m.uri && a.indexOf(m, i + 1) === -1)

			// only want resolved text file service models
			.map(m => this.textFileService.files.get(m!.uri))
			.filter(m => m?.isResolved()) as IResolvedTextFileEditorModel[];

		const set = new Set(models);
		const newModels = models.filter(o => !this.items.has(o));
		const oldModels = [...this.items.keys()].filter(m => !set.has(m));

		oldModels.forEach(m => this.onModelInvisible(m));
		newModels.forEach(m => this.onModelVisible(m));
	}