@@ -24,6 +24,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
2424import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
2525import { EventHelper } from 'vs/base/browser/dom' ;
2626import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation' ;
27+ import { IPanelService } from 'vs/workbench/services/panel/common/panelService' ;
2728
2829export class ProgressService implements IProgressService , IDisposable {
2930
@@ -35,6 +36,7 @@ export class ProgressService implements IProgressService, IDisposable {
3536 constructor (
3637 @IActivityService private readonly _activityBar : IActivityService ,
3738 @IViewletService private readonly _viewletService : IViewletService ,
39+ @IPanelService private readonly _panelService : IPanelService ,
3840 @INotificationService private readonly _notificationService : INotificationService ,
3941 @IStatusbarService private readonly _statusbarService : IStatusbarService ,
4042 @ILayoutService private readonly _layoutService : ILayoutService ,
@@ -49,11 +51,14 @@ export class ProgressService implements IProgressService, IDisposable {
4951 withProgress < R = unknown > ( options : IProgressOptions , task : ( progress : IProgress < IProgressStep > ) => Promise < R > , onDidCancel ?: ( ) => void ) : Promise < R > {
5052 const { location } = options ;
5153 if ( typeof location === 'string' ) {
52- const viewlet = this . _viewletService . getViewlet ( location ) ;
53- if ( viewlet ) {
54+ if ( this . _viewletService . getProgressIndicator ( location ) ) {
5455 return this . _withViewletProgress ( location , task , { ...options , location } ) ;
5556 }
5657
58+ if ( this . _panelService . getProgressIndicator ( location ) ) {
59+ return this . _withPanelProgress ( location , task , { ...options , location } ) ;
60+ }
61+
5762 return Promise . reject ( new Error ( `Bad progress location: ${ location } ` ) ) ;
5863 }
5964
@@ -281,6 +286,18 @@ export class ProgressService implements IProgressService, IDisposable {
281286 return promise ;
282287 }
283288
289+ private _withPanelProgress < P extends Promise < R > , R = unknown > ( panelid : string , task : ( progress : IProgress < { message ?: string } > ) => P , options : IProgressCompositeOptions ) : P {
290+ const promise = task ( emptyProgress ) ;
291+
292+ // show in panel
293+ const panelProgress = this . _panelService . getProgressIndicator ( panelid ) ;
294+ if ( panelProgress ) {
295+ panelProgress . showWhile ( promise , options . delay ) ;
296+ }
297+
298+ return promise ;
299+ }
300+
284301 private _withDialogProgress < P extends Promise < R > , R = unknown > ( options : IProgressOptions , task : ( progress : IProgress < { message ?: string , increment ?: number } > ) => P , onDidCancel ?: ( ) => void ) : P {
285302 const disposables = new DisposableStore ( ) ;
286303 const allowableCommands = [
0 commit comments