Skip to content

Chat sessions view #257371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 23, 2025
Merged
Prev Previous commit
Next Next commit
Title listeners
  • Loading branch information
osortega committed Jul 23, 2025
commit c461256102af31cd59a477ef07fc9461c51c0c88
33 changes: 33 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chatSessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,41 @@ class LocalChatSessionsProvider extends Disposable implements IChatSessionItemPr
'viewId' in widget.viewContext &&
widget.viewContext.viewId === LocalChatSessionsProvider.CHAT_WIDGET_VIEW_ID) {
this._onDidChange.fire();

// Listen for view model changes on this widget
this._register(widget.onDidChangeViewModel(() => {
this._onDidChange.fire();
}));

// Listen for title changes on the current model
this.registerModelTitleListener(widget);
}
}));

// Check for existing chat widgets and register listeners
const existingWidgets = this.chatWidgetService.getWidgetsByLocations(ChatAgentLocation.Panel)
.filter(widget => typeof widget.viewContext === 'object' && 'viewId' in widget.viewContext && widget.viewContext.viewId === LocalChatSessionsProvider.CHAT_WIDGET_VIEW_ID);

existingWidgets.forEach(widget => {
this._register(widget.onDidChangeViewModel(() => {
this._onDidChange.fire();
this.registerModelTitleListener(widget);
}));

// Register title listener for existing widget
this.registerModelTitleListener(widget);
});
}

private registerModelTitleListener(widget: IChatWidget): void {
const model = widget.viewModel?.model;
if (model) {
// Listen for model changes to detect title changes
// Since setCustomTitle doesn't fire an event, we listen to general model changes
this._register(model.onDidChange(() => {
this._onDidChange.fire();
}));
}
}

private initializeCurrentEditorSet(): void {
Expand Down
Loading