src/vs/workbench/services/textfile/common/textFileEditorModelManager.ts/TextFileEditorModelManager/onDidRunWorkingCopyFileOperation
class TextFileEditorModelManager:	private onDidRunWorkingCopyFileOperation(e: WorkingCopyFileEvent): void {
		switch (e.operation) {

			// Create: Revert existing models
			case FileOperation.CREATE:
				e.waitUntil((async () => {
					for (const { target } of e.files) {
						const model = this.get(target);
						if (model && !model.isDisposed()) {
							await model.revert();
						}
					}
				})());
				break;

			// Move/Copy: restore models that were resolved before the operation took place
			case FileOperation.MOVE:
			case FileOperation.COPY:
				e.waitUntil((async () => {
					const modelsToRestore = this.mapCorrelationIdToModelsToRestore.get(e.correlationId);
					if (modelsToRestore) {
						this.mapCorrelationIdToModelsToRestore.delete(e.correlationId);

						await Promises.settled(modelsToRestore.map(async modelToRestore => {

							// restore the model at the target. if we have previous dirty content, we pass it
							// over to be used, otherwise we force a reload from disk. this is important
							// because we know the file has changed on disk after the move and the model might
							// have still existed with the previous state. this ensures that the model is not
							// tracking a stale state.
							const restoredModel = await this.resolve(modelToRestore.target, {
								reload: { async: false }, // enforce a reload
								contents: modelToRestore.snapshot ? createTextBufferFactoryFromSnapshot(modelToRestore.snapshot) : undefined,
								encoding: modelToRestore.encoding
							});

							// restore previous language only if the language is now unspecified and it was specified
							// but not when the file was explicitly stored with the plain text extension
							// (https://github.com/microsoft/vscode/issues/125795)
							if (
								modelToRestore.languageId &&
								modelToRestore.languageId !== PLAINTEXT_LANGUAGE_ID &&
								restoredModel.getLanguageId() === PLAINTEXT_LANGUAGE_ID &&
								extname(modelToRestore.target) !== PLAINTEXT_EXTENSION
							) {
								restoredModel.updateTextEditorModel(undefined, modelToRestore.languageId);
							}
						}));
					}
				})());
				break;
		}
	}