this.telemetryService.publicLog2<ExtensionUrlHandlerEvent, ExtensionUrlHandlerClassification>('uri_invoked/install_extension/accept', { extensionId: extensionIdentifier.id }); try { <del> await this.progressService.withProgress({ </del> <ins> extension = await this.progressService.withProgress({ </ins> location: ProgressLocation.Notification, title: localize('Installing', "Installing Extension '{0}'...", galleryExtension.displayName || galleryExtension.name) }, () => this.extensionManagementService.installFromGallery(galleryExtension!)); <del> this.notificationService.prompt( Severity.Info, localize('reload', "Would you like to reload the window and open the URL '{0}'?", uri.toString()), [{ label: localize('Reload', "Reload Window and Open"), run: async () => { this.telemetryService.publicLog2<ExtensionUrlHandlerEvent, ExtensionUrlHandlerClassification>('uri_invoked/install_extension/reload', { extensionId: extensionIdentifier.id }); await this.reloadAndHandle(uri); } }], { sticky: true } ); </del> } catch (error) { this.notificationService.error(error); <ins> return; } } // Extension is installed but not enabled if (!this.extensionEnablementService.isEnabled(extension)) { this.telemetryService.publicLog2<ExtensionUrlHandlerEvent, ExtensionUrlHandlerClassification>('uri_invoked/enable_extension/start', { extensionId: extensionIdentifier.id }); const result = await this.dialogService.confirm({ message: localize('enableAndHandle', "Extension '{0}' is disabled. Would you like to enable the extension and open the URL?", extension.manifest.displayName || extension.manifest.name), detail: `${extension.manifest.displayName || extension.manifest.name} (${extensionIdentifier.id}) wants to open a URL:nn${uri.toString()}`, primaryButton: localize('enableAndReload', "&&Enable and Open"), type: 'question' }); if (!result.confirmed) { this.telemetryService.publicLog2<ExtensionUrlHandlerEvent, ExtensionUrlHandlerClassification>('uri_invoked/enable_extension/cancel', { extensionId: extensionIdentifier.id }); return; </ins> } <ins> this.telemetryService.publicLog2<ExtensionUrlHandlerEvent, ExtensionUrlHandlerClassification>('uri_invoked/enable_extension/accept', { extensionId: extensionIdentifier.id }); await this.extensionEnablementService.setEnablement([extension], EnablementState.EnabledGlobally); } if (this.extensionService.canAddExtension(toExtensionDescription(extension))) { await this.waitUntilExtensionIsAdded(extensionIdentifier); await this.handleURL(uri, { ...options, trusted: true }); } /* Extension cannot be added and require window reload */ else { this.telemetryService.publicLog2<ExtensionUrlHandlerEvent, ExtensionUrlHandlerClassification>('uri_invoked/activate_extension/start', { extensionId: extensionIdentifier.id }); const result = await this.dialogService.confirm({ message: localize('reloadAndHandle', "Extension '{0}' is not loaded. Would you like to reload the window to load the extension and open the URL?", extension.manifest.displayName || extension.manifest.name), detail: `${extension.manifest.displayName || extension.manifest.name} (${extensionIdentifier.id}) wants to open a URL:nn${uri.toString()}`, primaryButton: localize('reloadAndOpen', "&&Reload Window and Open"), type: 'question' }); if (!result.confirmed) { this.telemetryService.publicLog2<ExtensionUrlHandlerEvent, ExtensionUrlHandlerClassification>('uri_invoked/activate_extension/cancel', { extensionId: extensionIdentifier.id }); return; } this.telemetryService.publicLog2<ExtensionUrlHandlerEvent, ExtensionUrlHandlerClassification>('uri_invoked/activate_extension/accept', { extensionId: extensionIdentifier.id }); this.storageService.store(URL_TO_HANDLE, JSON.stringify(uri.toJSON()), StorageScope.WORKSPACE, StorageTarget.MACHINE); await this.hostService.reload(); </ins> } } <del> private async reloadAndHandle(url: URI): Promise<void> { this.storageService.store(URL_TO_HANDLE, JSON.stringify(url.toJSON()), StorageScope.WORKSPACE, StorageTarget.MACHINE); await this.hostService.reload(); </del> <ins> private async waitUntilExtensionIsAdded(extensionId: IExtensionIdentifier): Promise<void> { if (!(await this.extensionService.getExtension(extensionId.id))) { await new Promise<void>((c, e) => { const disposable = this.extensionService.onDidChangeExtensions(async () => { try { if (await this.extensionService.getExtension(extensionId.id)) { disposable.dispose(); c(); } } catch (error) { e(error); } }); }); } </ins> } // forget about all uris buffered more than 5 minutes ago