Skip to content

Commit 4949904

Browse files
Copilotroblourens
andcommitted
Use IProgressService instead of ViewPane.getProgressIndicator for chat sessions progress
Co-authored-by: roblourens <[email protected]>
1 parent bd3cada commit 4949904

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

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

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { IContextMenuService } from '../../../../platform/contextview/browser/co
1010
import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
1111
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
1212
import { ILogService } from '../../../../platform/log/common/log.js';
13+
import { IProgressService } from '../../../../platform/progress/common/progress.js';
1314
import { Registry } from '../../../../platform/registry/common/platform.js';
1415
import { IStorageService } from '../../../../platform/storage/common/storage.js';
1516
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
@@ -678,6 +679,7 @@ class SessionsViewPane extends ViewPane {
678679
@IEditorService private readonly editorService: IEditorService,
679680
@IViewsService private readonly viewsService: IViewsService,
680681
@ILogService private readonly logService: ILogService,
682+
@IProgressService private readonly progressService: IProgressService,
681683
) {
682684
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, hoverService);
683685

@@ -710,12 +712,16 @@ class SessionsViewPane extends ViewPane {
710712
return;
711713
}
712714

713-
const progressIndicator = this.getProgressIndicator();
714-
715715
try {
716-
// Show progress while refreshing tree data
717-
const refreshPromise = this.tree.updateChildren(this.provider);
718-
await progressIndicator.showWhile(refreshPromise, 0); // Show immediately, no delay
716+
await this.progressService.withProgress(
717+
{
718+
location: this.id, // Use the view ID as the progress location
719+
title: nls.localize('chatSessions.refreshing', 'Refreshing chat sessions...'),
720+
},
721+
async () => {
722+
await this.tree!.updateChildren(this.provider);
723+
}
724+
);
719725
} catch (error) {
720726
// Log error but don't throw to avoid breaking the UI
721727
this.logService.error('Error refreshing chat sessions tree:', error);
@@ -731,12 +737,16 @@ class SessionsViewPane extends ViewPane {
731737
return;
732738
}
733739

734-
const progressIndicator = this.getProgressIndicator();
735-
736740
try {
737-
// Show progress while loading data
738-
const loadingPromise = this.tree.setInput(this.provider);
739-
await progressIndicator.showWhile(loadingPromise, 0); // Show immediately, no delay
741+
await this.progressService.withProgress(
742+
{
743+
location: this.id, // Use the view ID as the progress location
744+
title: nls.localize('chatSessions.loading', 'Loading chat sessions...'),
745+
},
746+
async () => {
747+
await this.tree!.setInput(this.provider);
748+
}
749+
);
740750
} catch (error) {
741751
// Log error but don't throw to avoid breaking the UI
742752
this.logService.error('Error loading chat sessions data:', error);

0 commit comments

Comments
 (0)