@@ -9,6 +9,8 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
99import { Event , Emitter } from 'vs/base/common/event' ;
1010import { Disposable } from 'vs/base/common/lifecycle' ;
1111import { ILogService } from 'vs/platform/log/common/log' ;
12+ import { IProgressService2 , ProgressLocation } from 'vs/platform/progress/common/progress' ;
13+ import { localize } from 'vs/nls' ;
1214
1315export class CommandService extends Disposable implements ICommandService {
1416
@@ -22,7 +24,8 @@ export class CommandService extends Disposable implements ICommandService {
2224 constructor (
2325 @IInstantiationService private readonly _instantiationService : IInstantiationService ,
2426 @IExtensionService private readonly _extensionService : IExtensionService ,
25- @ILogService private readonly _logService : ILogService
27+ @ILogService private readonly _logService : ILogService ,
28+ @IProgressService2 private readonly _progressService : IProgressService2 ,
2629 ) {
2730 super ( ) ;
2831 this . _extensionService . whenInstalledExtensionsRegistered ( ) . then ( value => this . _extensionHostIsReady = value ) ;
@@ -35,17 +38,23 @@ export class CommandService extends Disposable implements ICommandService {
3538 // we don't wait for it when the extension
3639 // host didn't yet start and the command is already registered
3740
38- const activation = Promise . resolve ( this . _extensionService . activateByEvent ( `onCommand:${ id } ` ) ) ;
41+ const activation : Thenable < any > = this . _extensionService . activateByEvent ( `onCommand:${ id } ` ) ;
3942 const commandIsRegistered = ! ! CommandsRegistry . getCommand ( id ) ;
4043
4144 if ( ! this . _extensionHostIsReady && commandIsRegistered ) {
4245 return this . _tryExecuteCommand ( id , args ) ;
4346 } else {
44- let waitFor : Promise < any > = activation ;
47+ let waitFor = activation ;
4548 if ( ! commandIsRegistered ) {
4649 waitFor = Promise . all ( [ activation , this . _extensionService . activateByEvent ( `*` ) ] ) ;
4750 }
48- return waitFor . then ( _ => this . _tryExecuteCommand ( id , args ) ) ;
51+
52+ this . _progressService . withProgress ( {
53+ location : ProgressLocation . Window ,
54+ title : localize ( 'activating' , "Activating extensions for command '{0}'..." , id )
55+ } , ( ) => waitFor ) ;
56+
57+ return ( waitFor as Promise < any > ) . then ( _ => this . _tryExecuteCommand ( id , args ) ) ;
4958 }
5059 }
5160
0 commit comments