Skip to content

Commit c59c59b

Browse files
authored
fix: remove chat edits file suggestions when working set is emptied (microsoft#235433)
1 parent d3273e5 commit c59c59b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingActions.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ registerAction2(class RemoveFileFromWorkingSet extends WorkingSetAction {
109109
for (const uri of uris) {
110110
chatWidget.attachmentModel.delete(uri.toString());
111111
}
112+
113+
// If there are now only suggested files in the working set, also clear those
114+
const entries = [...currentEditingSession.workingSet.entries()];
115+
const suggestedFiles = entries.filter(([_, state]) => state.state === WorkingSetEntryState.Suggested);
116+
if (suggestedFiles.length === entries.length && !chatWidget.attachmentModel.attachments.find((v) => v.isFile && URI.isUri(v.value))) {
117+
currentEditingSession.remove(WorkingSetEntryRemovalReason.Programmatic, ...entries.map(([uri,]) => uri));
118+
}
112119
}
113120
});
114121

0 commit comments

Comments
 (0)