@@ -866,22 +866,30 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
866
866
run : async ( accessor : ServicesAccessor ) => {
867
867
const extensionManagementService = accessor . get ( IWorkbenchExtensionManagementService ) ;
868
868
if ( isWeb ) {
869
- const quickInputService = accessor . get ( IQuickInputService ) ;
870
- const disposables = new DisposableStore ( ) ;
871
- const quickPick = disposables . add ( quickInputService . createQuickPick ( ) ) ;
872
- quickPick . title = localize ( 'installFromLocation' , "Install Extension from Location" ) ;
873
- quickPick . customButton = true ;
874
- quickPick . customLabel = localize ( 'install button' , "Install" ) ;
875
- quickPick . placeholder = localize ( 'installFromLocationPlaceHolder' , "Location of the web extension" ) ;
876
- quickPick . ignoreFocusOut = true ;
877
- disposables . add ( Event . any ( quickPick . onDidAccept , quickPick . onDidCustom ) ( ( ) => {
878
- quickPick . hide ( ) ;
879
- if ( quickPick . value ) {
880
- extensionManagementService . installFromLocation ( URI . parse ( quickPick . value ) ) ;
881
- }
882
- } ) ) ;
883
- disposables . add ( quickPick . onDidHide ( ( ) => disposables . dispose ( ) ) ) ;
884
- quickPick . show ( ) ;
869
+ return new Promise < void > ( ( c , e ) => {
870
+ const quickInputService = accessor . get ( IQuickInputService ) ;
871
+ const disposables = new DisposableStore ( ) ;
872
+ const quickPick = disposables . add ( quickInputService . createQuickPick ( ) ) ;
873
+ quickPick . title = localize ( 'installFromLocation' , "Install Extension from Location" ) ;
874
+ quickPick . customButton = true ;
875
+ quickPick . customLabel = localize ( 'install button' , "Install" ) ;
876
+ quickPick . placeholder = localize ( 'installFromLocationPlaceHolder' , "Location of the web extension" ) ;
877
+ quickPick . ignoreFocusOut = true ;
878
+ disposables . add ( Event . any ( quickPick . onDidAccept , quickPick . onDidCustom ) ( async ( ) => {
879
+ quickPick . hide ( ) ;
880
+ if ( quickPick . value ) {
881
+ try {
882
+ await extensionManagementService . installFromLocation ( URI . parse ( quickPick . value ) ) ;
883
+ } catch ( error ) {
884
+ e ( error ) ;
885
+ return ;
886
+ }
887
+ }
888
+ c ( ) ;
889
+ } ) ) ;
890
+ disposables . add ( quickPick . onDidHide ( ( ) => disposables . dispose ( ) ) ) ;
891
+ quickPick . show ( ) ;
892
+ } ) ;
885
893
} else {
886
894
const fileDialogService = accessor . get ( IFileDialogService ) ;
887
895
const extensionLocation = await fileDialogService . showOpenDialog ( {
@@ -891,7 +899,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
891
899
title : localize ( 'installFromLocation' , "Install Extension from Location" ) ,
892
900
} ) ;
893
901
if ( extensionLocation ?. [ 0 ] ) {
894
- extensionManagementService . installFromLocation ( extensionLocation [ 0 ] ) ;
902
+ await extensionManagementService . installFromLocation ( extensionLocation [ 0 ] ) ;
895
903
}
896
904
}
897
905
}
0 commit comments