Skip to content

Commit 3855ebd

Browse files
bhavyausCopilot
andauthored
fix: update clear functionality in ChatTodoListWidget (microsoft#268604)
* fix: update clear functionality in ChatTodoListWidget * Update src/vs/workbench/contrib/chat/browser/chatWidget.ts Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent bc16a59 commit 3855ebd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/vs/workbench/contrib/chat/browser/chatContentParts/chatTodoListWidget.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ export class ChatTodoListWidget extends Disposable {
136136
this.updateTodoDisplay();
137137
}
138138

139-
public clear(sessionId: string | undefined): void {
139+
public clear(sessionId: string | undefined, force: boolean = false): void {
140140
if (!sessionId || this.domNode.style.display === 'none') {
141141
return;
142142
}
143143

144144
const currentTodos = this.chatTodoListService.getTodos(sessionId);
145-
const todoListCompleted = !currentTodos.some(todo => todo.status !== 'completed');
146-
if (todoListCompleted) {
145+
const shouldClear = force || !currentTodos.some(todo => todo.status !== 'completed');
146+
if (shouldClear) {
147147
this.clearAllTodos();
148148
}
149149
}

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
852852
// Unlock coding agent when clearing
853853
this.unlockFromCodingAgent();
854854
this._onDidClear.fire();
855+
this.chatTodoListWidget.clear(this.viewModel?.sessionId, true);
855856
}
856857

857858
private onDidChangeItems(skipDynamicLayout?: boolean) {
@@ -2059,8 +2060,8 @@ export class ChatWidget extends Disposable implements IChatWidget {
20592060
if (e.kind === 'setAgent') {
20602061
this._onDidChangeAgent.fire({ agent: e.agent, slashCommand: e.command });
20612062
}
2062-
if (e.kind === 'addRequest') {
2063-
this.chatTodoListWidget.clear(model.sessionId);
2063+
if (e.kind === 'addRequest' || e.kind === 'removeRequest') {
2064+
this.chatTodoListWidget.clear(model.sessionId, e.kind === 'removeRequest' /*force*/);
20642065
}
20652066
}));
20662067

0 commit comments

Comments
 (0)