Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chatListRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,19 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch

}

resetSession(): void {
for (const templateData of this.templateDataByRequestId.values()) {
this.clearRenderedParts(templateData);
templateData.elementDisposables.clear();
templateData.currentElement = undefined;
}
this.templateDataByRequestId.clear();
this.codeBlocksByResponseId.clear();
this.codeBlocksByEditorUri.clear();
this.fileTreesByResponseId.clear();
this.focusedFileTreesByResponseId.clear();
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The resetSession() method should clear _announcedToolProgressKeys for consistency with updateViewModel(). This set tracks which tool progress has been announced to screen readers. When a session is reset, this state should also be cleared to ensure proper accessibility announcements in the new session.

Suggested fix:

resetSession(): void {
    for (const templateData of this.templateDataByRequestId.values()) {
        this.clearRenderedParts(templateData);
        templateData.elementDisposables.clear();
        templateData.currentElement = undefined;
    }
    this.templateDataByRequestId.clear();
    this.codeBlocksByResponseId.clear();
    this.codeBlocksByEditorUri.clear();
    this.fileTreesByResponseId.clear();
    this.focusedFileTreesByResponseId.clear();
    this._announcedToolProgressKeys.clear();  // Add this line
}
Suggested change
this.focusedFileTreesByResponseId.clear();
this.focusedFileTreesByResponseId.clear();
this._announcedToolProgressKeys.clear();

Copilot uses AI. Check for mistakes.
}

getCodeBlockInfoForEditor(uri: URI): IChatCodeBlockInfo | undefined {
return this.codeBlocksByEditorUri.get(uri);
}
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chatWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
this.inputPart.clearTodoListWidget(this.viewModel?.sessionResource, true);
this.chatSuggestNextWidget.hide();
await this.viewOptions.clear?.();
this.renderer?.resetSession();
}

private onDidChangeItems(skipDynamicLayout?: boolean) {
Expand Down Expand Up @@ -1967,6 +1968,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
}

if (!model) {
this.renderer?.resetSession();
this.viewModel = undefined;
this.onDidChangeItems();
return;
Expand All @@ -1975,6 +1977,8 @@ export class ChatWidget extends Disposable implements IChatWidget {
if (isEqual(model.sessionResource, this.viewModel?.sessionResource)) {
return;
}

this.renderer?.resetSession();
this.inputPart.clearTodoListWidget(model.sessionResource, false);
this.chatSuggestNextWidget.hide();

Expand Down
Loading