From cf3c659176dea22944faa794cda1c60b383139c9 Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Wed, 11 Oct 2023 12:30:38 +0000 Subject: [PATCH 1/2] Improve language quick pick responsiveness --- .../src/browser/i18n/language-quick-pick-service.ts | 1 + .../src/browser/vsx-language-quick-pick-service.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/packages/core/src/browser/i18n/language-quick-pick-service.ts b/packages/core/src/browser/i18n/language-quick-pick-service.ts index 88210abbb4660..d0b2fc9af5f27 100644 --- a/packages/core/src/browser/i18n/language-quick-pick-service.ts +++ b/packages/core/src/browser/i18n/language-quick-pick-service.ts @@ -80,6 +80,7 @@ export class LanguageQuickPickService { } else { resolve(undefined); } + quickInput.hide(); }); quickInput.onDidHide(() => { resolve(undefined); diff --git a/packages/vsx-registry/src/browser/vsx-language-quick-pick-service.ts b/packages/vsx-registry/src/browser/vsx-language-quick-pick-service.ts index adc765f7df79b..fd20519fd39e8 100644 --- a/packages/vsx-registry/src/browser/vsx-language-quick-pick-service.ts +++ b/packages/vsx-registry/src/browser/vsx-language-quick-pick-service.ts @@ -22,6 +22,8 @@ import { PluginPackage, PluginServer } from '@theia/plugin-ext'; import { OVSXClientProvider } from '../common/ovsx-client-provider'; import { VSXSearchEntry } from '@theia/ovsx-client'; import { VSCodeExtensionUri } from '@theia/plugin-ext-vscode/lib/common/plugin-vscode-uri'; +import { nls } from '@theia/core/lib/common/nls'; +import { MessageService } from '@theia/core/lib/common/message-service'; @injectable() export class VSXLanguageQuickPickService extends LanguageQuickPickService { @@ -35,6 +37,9 @@ export class VSXLanguageQuickPickService extends LanguageQuickPickService { @inject(PluginServer) protected readonly pluginServer: PluginServer; + @inject(MessageService) + protected readonly messageService: MessageService; + protected override async getAvailableLanguages(): Promise { const client = await this.clientProvider(); const searchResult = await client.search({ @@ -62,8 +67,13 @@ export class VSXLanguageQuickPickService extends LanguageQuickPickService { languages.set(localizationContribution.languageId, { ...this.createLanguageQuickPickItem(localizationContribution), execute: async () => { + const progress = await this.messageService.showProgress({ + text: nls.localizeByDefault('Installing {0} language support...', + localizationContribution.localizedLanguageName ?? localizationContribution.languageName ?? localizationContribution.languageId), + }); const extensionUri = VSCodeExtensionUri.toUri(extension.extension.name, extension.extension.namespace).toString(); await this.pluginServer.deploy(extensionUri); + progress.cancel(); } }); } From 590129497955e5d903d63af0e41e82e4314203ff Mon Sep 17 00:00:00 2001 From: Mark Sujew Date: Wed, 11 Oct 2023 12:32:20 +0000 Subject: [PATCH 2/2] Add try-finally block --- .../src/browser/vsx-language-quick-pick-service.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/vsx-registry/src/browser/vsx-language-quick-pick-service.ts b/packages/vsx-registry/src/browser/vsx-language-quick-pick-service.ts index fd20519fd39e8..35af7885c4465 100644 --- a/packages/vsx-registry/src/browser/vsx-language-quick-pick-service.ts +++ b/packages/vsx-registry/src/browser/vsx-language-quick-pick-service.ts @@ -71,9 +71,12 @@ export class VSXLanguageQuickPickService extends LanguageQuickPickService { text: nls.localizeByDefault('Installing {0} language support...', localizationContribution.localizedLanguageName ?? localizationContribution.languageName ?? localizationContribution.languageId), }); - const extensionUri = VSCodeExtensionUri.toUri(extension.extension.name, extension.extension.namespace).toString(); - await this.pluginServer.deploy(extensionUri); - progress.cancel(); + try { + const extensionUri = VSCodeExtensionUri.toUri(extension.extension.name, extension.extension.namespace).toString(); + await this.pluginServer.deploy(extensionUri); + } finally { + progress.cancel(); + } } }); }