@@ -1745,7 +1745,9 @@ export class InstallWorkspaceRecommendedExtensionsAction extends Action {
17451745 @INotificationService private readonly notificationService : INotificationService ,
17461746 @IInstantiationService private readonly instantiationService : IInstantiationService ,
17471747 @IOpenerService private readonly openerService : IOpenerService ,
1748- @IExtensionsWorkbenchService private readonly extensionWorkbenchService : IExtensionsWorkbenchService
1748+ @IExtensionsWorkbenchService private readonly extensionWorkbenchService : IExtensionsWorkbenchService ,
1749+ @IConfigurationService private readonly configurationService : IConfigurationService ,
1750+ @IExtensionManagementServerService private readonly extensionManagementServerService : IExtensionManagementServerService
17491751 ) {
17501752 super ( id , label , 'extension-action' ) ;
17511753 this . recommendations = recommendations ;
@@ -1762,17 +1764,30 @@ export class InstallWorkspaceRecommendedExtensionsAction extends Action {
17621764 let installPromises : Promise < any > [ ] = [ ] ;
17631765 let model = new PagedModel ( pager ) ;
17641766 for ( let i = 0 ; i < pager . total ; i ++ ) {
1765- installPromises . push ( model . resolve ( i , CancellationToken . None ) . then ( e => {
1766- return this . extensionWorkbenchService . install ( e ) . then ( undefined , err => {
1767- console . error ( err ) ;
1768- return promptDownloadManually ( e . gallery , localize ( 'failedToInstall' , "Failed to install \'{0}\'." , e . identifier . id ) , err , this . instantiationService , this . notificationService , this . openerService ) ;
1769- } ) ;
1770- } ) ) ;
1767+ installPromises . push ( model . resolve ( i , CancellationToken . None ) . then ( e => this . installExtension ( e ) ) ) ;
17711768 }
17721769 return Promise . all ( installPromises ) ;
17731770 } ) ;
17741771 } ) ;
17751772 }
1773+
1774+ private async installExtension ( extension : IExtension ) : Promise < void > {
1775+ try {
1776+ if ( extension . local && extension . gallery ) {
1777+ if ( isUIExtension ( extension . local . manifest , this . configurationService ) ) {
1778+ await this . extensionManagementServerService . localExtensionManagementServer . extensionManagementService . installFromGallery ( extension . gallery ) ;
1779+ return ;
1780+ } else if ( this . extensionManagementServerService . remoteExtensionManagementServer ) {
1781+ await this . extensionManagementServerService . remoteExtensionManagementServer . extensionManagementService . installFromGallery ( extension . gallery ) ;
1782+ return ;
1783+ }
1784+ }
1785+ await this . extensionWorkbenchService . install ( extension ) ;
1786+ } catch ( err ) {
1787+ console . error ( err ) ;
1788+ return promptDownloadManually ( extension . gallery , localize ( 'failedToInstall' , "Failed to install \'{0}\'." , extension . identifier . id ) , err , this . instantiationService , this . notificationService , this . openerService ) ;
1789+ }
1790+ }
17761791}
17771792
17781793export class InstallRecommendedExtensionAction extends Action {
0 commit comments