Skip to content

Commit

Permalink
Improve language quick pick responsiveness (#12992)
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew authored Oct 12, 2023
1 parent c625ba1 commit ff1ee2b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class LanguageQuickPickService {
} else {
resolve(undefined);
}
quickInput.hide();
});
quickInput.onDidHide(() => {
resolve(undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<LanguageQuickPickItem[]> {
const client = await this.clientProvider();
const searchResult = await client.search({
Expand Down Expand Up @@ -62,8 +67,16 @@ export class VSXLanguageQuickPickService extends LanguageQuickPickService {
languages.set(localizationContribution.languageId, {
...this.createLanguageQuickPickItem(localizationContribution),
execute: async () => {
const extensionUri = VSCodeExtensionUri.toUri(extension.extension.name, extension.extension.namespace).toString();
await this.pluginServer.deploy(extensionUri);
const progress = await this.messageService.showProgress({
text: nls.localizeByDefault('Installing {0} language support...',
localizationContribution.localizedLanguageName ?? localizationContribution.languageName ?? localizationContribution.languageId),
});
try {
const extensionUri = VSCodeExtensionUri.toUri(extension.extension.name, extension.extension.namespace).toString();
await this.pluginServer.deploy(extensionUri);
} finally {
progress.cancel();
}
}
});
}
Expand Down

0 comments on commit ff1ee2b

Please sign in to comment.