Skip to content

Conversation

@connor4312
Copy link
Member

Add support for file deletion operations in chat editing sessions through
new ChatResponseWorkspaceEditPart. This allows agents to represent file-level
operations (deletions, creations, renames) alongside text and notebook edits.

  • Adds ChatEditingDeletedFileEntry class to represent deleted files with
    proper diff display and restoration functionality
  • Introduces ChatResponseWorkspaceEditPart and IChatWorkspaceEdit interfaces
    for file-level operations at the workspace level
  • Implements workspace edit streaming through chat editing sessions with
    proper undo/redo support
  • Adds ChatWorkspaceEditContentPart for UI rendering of file operations
  • Extends chat session storage to serialize deleted file entries
  • Supports both acceptance and rejection of file deletions with proper state
    management and snapshotting

Ref #275705

(Commit message generated by Copilot)

Add support for file deletion operations in chat editing sessions through
new ChatResponseWorkspaceEditPart. This allows agents to represent file-level
operations (deletions, creations, renames) alongside text and notebook edits.

- Adds ChatEditingDeletedFileEntry class to represent deleted files with
  proper diff display and restoration functionality
- Introduces ChatResponseWorkspaceEditPart and IChatWorkspaceEdit interfaces
  for file-level operations at the workspace level
- Implements workspace edit streaming through chat editing sessions with
  proper undo/redo support
- Adds ChatWorkspaceEditContentPart for UI rendering of file operations
- Extends chat session storage to serialize deleted file entries
- Supports both acceptance and rejection of file deletions with proper state
  management and snapshotting

Ref #275705

(Commit message generated by Copilot)
Copilot AI review requested due to automatic review settings January 21, 2026 00:32
@connor4312 connor4312 enabled auto-merge (squash) January 21, 2026 00:32
@vs-code-engineering
Copy link

vs-code-engineering bot commented Jan 21, 2026

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@jrieken

Matched files:

  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingDeletedFileEntry.ts
  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.ts
  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.ts
  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.ts
  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.ts
  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.ts
  • src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.ts
  • src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for file deletion operations in chat editing sessions. The implementation introduces a new ChatResponseWorkspaceEditPart API and supporting infrastructure to enable chat agents to delete files alongside text and notebook edits.

Changes:

  • Adds new API surface (ChatResponseWorkspaceEditPart, ChatWorkspaceFileEdit) for workspace-level file operations
  • Implements ChatEditingDeletedFileEntry class to represent deleted files with proper diff display and undo/redo functionality
  • Extends storage, UI rendering, and session management to handle file deletions

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
vscode.proposed.chatParticipantAdditions.d.ts Adds API definitions for workspace edit parts and file edit operations
extHostTypes.ts Implements ChatResponseWorkspaceEditPart class for extension host
extHostTypeConverters.ts Adds type conversion logic for workspace edits
extHostChatAgents2.ts Integrates workspace edit method into chat response stream
extHost.api.impl.ts Exports new API class for extensions
chatService.ts Defines IChatWorkspaceEdit and IChatWorkspaceFileEdit interfaces
chatEditingService.ts Adds applyWorkspaceEdit method and deletion support to session interface
chatModel.ts Extends progress content types to include workspace edits
chatSessionOperationLog.ts Adds workspace edit to operation log schema
chatEditingSession.ts Implements deletion logic including file operations, timeline recording, and snapshot restoration
chatEditingServiceImpl.ts Integrates workspace edit processing into response streaming
chatEditingDeletedFileEntry.ts New file implementing deleted file entry with diff display and restoration
chatEditingSessionStorage.ts Adds serialization support for deleted file entries
chatListRenderer.ts Registers workspace edit content part renderer
chatWorkspaceEditContentPart.ts New file implementing UI rendering for file operations
chatInputPart.ts Adds special handling for opening deleted files in the working set
chatProgressContentPart.ts Expands constructor parameter type to support workspace edit rendering
chatEditingModifiedFileEntry.ts Removes hasModificationAt method (no longer needed)
chatEditingModifiedDocumentEntry.ts Removes hasModificationAt method and cleans up imports
chatEditingModifiedNotebookEntry.ts Removes hasModificationAt method and reorders imports
chatEditingNotebookCellEntry.ts Removes hasModificationAt method
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingDeletedFileEntry.ts:219

  • The undo and redo operations in the undo/redo element lack error handling. File operations (writeFile and del) can fail due to permissions, disk space, or file system issues. If these operations fail, the undo/redo system will be in an inconsistent state. Consider adding error handling and potentially notifying the user of failures.
			undo: async () => {
				// Restore the file
				await this._fileService.writeFile(this.modifiedURI, VSBuffer.fromString(this._originalContent));
			},
			redo: async () => {
				// Delete the file again
				await this._fileService.del(this.modifiedURI, { useTrash: false });
			}

snapshotEntry.telemetryInfo,
snapshotEntry.languageId
);
await entry.restoreFromSnapshot(snapshotEntry, false);
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snapshot restoration logic at line 888 always passes false for restoreToDisk when restoring deleted file entries. This means deleted files are never restored to disk during snapshot restoration, which may be inconsistent with the behavior for non-deleted entries (lines 890-894) where restoreToDisk is conditionally set based on whether the state is Modified. Consider whether deleted file entries should also have conditional restoration based on their state, or if this asymmetry is intentional.

Suggested change
await entry.restoreFromSnapshot(snapshotEntry, false);
const restoreToDisk = snapshotEntry.state === ModifiedFileEntryState.Modified;
await entry.restoreFromSnapshot(snapshotEntry, restoreToDisk);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants