33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { IProgress , IProgressService2 , IProgressStep , IProgressOptions } from 'vs/platform/progress/common/progress' ;
6+ import { IProgress , IProgressService2 , IProgressStep , ProgressLocation , IProgressOptions , IProgressNotificationOptions } from 'vs/platform/progress/common/progress' ;
77import { MainThreadProgressShape , MainContext , IExtHostContext , ExtHostProgressShape , ExtHostContext } from '../common/extHost.protocol' ;
88import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers' ;
9+ import { Action } from 'vs/base/common/actions' ;
10+ import { ExtensionIdentifier , IExtensionDescription } from 'vs/platform/extensions/common/extensions' ;
11+ import { ICommandService } from 'vs/platform/commands/common/commands' ;
12+ import { localize } from 'vs/nls' ;
13+
14+ class ManageExtensionAction extends Action {
15+ constructor ( id : ExtensionIdentifier , label : string , commandService : ICommandService ) {
16+ super ( id . value , label , undefined , true , ( ) => {
17+ return commandService . executeCommand ( '_extensions.manage' , id . value ) ;
18+ } ) ;
19+ }
20+ }
921
1022@extHostNamedCustomer ( MainContext . MainThreadProgress )
1123export class MainThreadProgress implements MainThreadProgressShape {
@@ -16,7 +28,8 @@ export class MainThreadProgress implements MainThreadProgressShape {
1628
1729 constructor (
1830 extHostContext : IExtHostContext ,
19- @IProgressService2 progressService : IProgressService2
31+ @IProgressService2 progressService : IProgressService2 ,
32+ @ICommandService private readonly _commandService : ICommandService
2033 ) {
2134 this . _proxy = extHostContext . getProxy ( ExtHostContext . ExtHostProgress ) ;
2235 this . _progressService = progressService ;
@@ -27,9 +40,19 @@ export class MainThreadProgress implements MainThreadProgressShape {
2740 this . _progress . clear ( ) ;
2841 }
2942
30- $startProgress ( handle : number , options : IProgressOptions ) : void {
43+ $startProgress ( handle : number , options : IProgressOptions , extension ?: IExtensionDescription ) : void {
3144 const task = this . _createTask ( handle ) ;
3245
46+ if ( options . location === ProgressLocation . Notification && extension && ! extension . isUnderDevelopment ) {
47+ const notificationOptions : IProgressNotificationOptions = {
48+ ...options ,
49+ location : ProgressLocation . Notification ,
50+ secondaryActions : [ new ManageExtensionAction ( extension . identifier , localize ( 'manageExtension' , "Manage Extension" ) , this . _commandService ) ]
51+ } ;
52+
53+ options = notificationOptions ;
54+ }
55+
3356 this . _progressService . withProgress ( options , task , ( ) => this . _proxy . $acceptProgressCanceled ( handle ) ) ;
3457 }
3558
0 commit comments