From 8717c1129ed1ac8791f9f509069829aa00eef3fb Mon Sep 17 00:00:00 2001 From: Joyce Er Date: Sun, 27 Oct 2024 16:15:03 -0700 Subject: [PATCH] fix: sync revert of chat-created file from SCM with chat editing list state (#232375) --- .../browser/chatEditing/chatEditingModifiedFileEntry.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.ts b/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.ts index 328ee43902d60..e2d1841f33c39 100644 --- a/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.ts +++ b/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.ts @@ -25,7 +25,7 @@ import { IModelService } from '../../../../../editor/common/services/model.js'; import { IResolvedTextEditorModel, ITextModelService } from '../../../../../editor/common/services/resolverService.js'; import { IModelContentChange, IModelContentChangedEvent } from '../../../../../editor/common/textModelEvents.js'; import { localize } from '../../../../../nls.js'; -import { FileOperation, IFileService } from '../../../../../platform/files/common/files.js'; +import { IFileService } from '../../../../../platform/files/common/files.js'; import { editorSelectionBackground } from '../../../../../platform/theme/common/colorRegistry.js'; import { IUndoRedoService } from '../../../../../platform/undoRedo/common/undoRedo.js'; import { IChatAgentResult } from '../../common/chatAgents.js'; @@ -152,8 +152,9 @@ export class ChatEditingModifiedFileEntry extends Disposable implements IModifie this._register(resourceRef); this._register(this.doc.onDidChangeContent(e => this._mirrorEdits(e))); - this._register(this._fileService.onDidRunOperation(e => { - if (e.operation === FileOperation.DELETE && kind === ChatEditKind.Created && e.resource.toString() === this.resource.toString()) { + this._register(this._fileService.watch(this.resource)); + this._register(this._fileService.onDidFilesChange(e => { + if (e.affects(this.resource) && kind === ChatEditKind.Created && e.gotDeleted()) { this._onDidDelete.fire(); this.dispose(); }