Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve language quick pick responsiveness #12992

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading