Skip to content

Commit

Permalink
fix: don't clear existing attachments when appending new ones
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceerhl committed Jul 25, 2024
1 parent 880043b commit 60b054e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/vs/workbench/contrib/chat/browser/chatInputPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,18 +348,20 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
}

attachContext(overwrite: boolean, ...contentReferences: IChatRequestVariableEntry[]): void {
const removed = Array.from(this._attachedContext);
const removed = [];
if (overwrite) {
removed.push(...Array.from(this._attachedContext));
this._attachedContext.clear();
}

if (contentReferences.length > 0) {
for (const reference of contentReferences) {
this._attachedContext.add(reference);
}
this.initAttachedContext(this.attachedContextContainer);
}

if (removed.length > 0 || contentReferences.length > 0) {
this.initAttachedContext(this.attachedContextContainer);
this._onDidChangeContext.fire({ removed, added: contentReferences });
}
}
Expand Down

0 comments on commit 60b054e

Please sign in to comment.