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

Small changes extensions updates view #161077

Merged
merged 3 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const SearchOutdatedExtensionsContext = new RawContextKey<boolean>('searchOutdat
const SearchEnabledExtensionsContext = new RawContextKey<boolean>('searchEnabledExtensions', false);
const SearchDisabledExtensionsContext = new RawContextKey<boolean>('searchDisabledExtensions', false);
const HasInstalledExtensionsContext = new RawContextKey<boolean>('hasInstalledExtensions', true);
const HasOutdatedExtensionsContext = new RawContextKey<boolean>('hasOutdatedExtensions', true);
export const BuiltInExtensionsContext = new RawContextKey<boolean>('builtInExtensions', false);
const SearchBuiltInExtensionsContext = new RawContextKey<boolean>('searchBuiltInExtensions', false);
const SearchUnsupportedWorkspaceExtensionsContext = new RawContextKey<boolean>('searchUnsupportedWorkspaceExtensions', false);
Expand Down Expand Up @@ -301,6 +302,7 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
name: localize('recently updated', "Recently Updated"),
ctorDescriptor: new SyncDescriptor(RecentlyUpdatedExtensionsView, [{}]),
when: ContextKeyExpr.or(SearchExtensionUpdatesContext, ContextKeyExpr.has('searchRecentlyUpdatedExtensions')),
order: 2,
});

/*
Expand Down Expand Up @@ -328,9 +330,10 @@ export class ExtensionsViewletViewsContribution implements IWorkbenchContributio
*/
viewDescriptors.push({
id: 'workbench.views.extensions.searchOutdated',
name: localize('outdated', "Outdated"),
name: localize('updates', "Updates"),
ctorDescriptor: new SyncDescriptor(OutdatedExtensionsView, [{}]),
when: ContextKeyExpr.or(SearchExtensionUpdatesContext, ContextKeyExpr.has('searchOutdatedExtensions')),
when: ContextKeyExpr.or(ContextKeyExpr.and(SearchExtensionUpdatesContext, HasOutdatedExtensionsContext), ContextKeyExpr.has('searchOutdatedExtensions')),
order: 1,
});

/*
Expand Down Expand Up @@ -468,6 +471,7 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE
private searchEnabledExtensionsContextKey: IContextKey<boolean>;
private searchDisabledExtensionsContextKey: IContextKey<boolean>;
private hasInstalledExtensionsContextKey: IContextKey<boolean>;
private hasOutdatedExtensionsContextKey: IContextKey<boolean>;
private builtInExtensionsContextKey: IContextKey<boolean>;
private searchBuiltInExtensionsContextKey: IContextKey<boolean>;
private searchWorkspaceUnsupportedExtensionsContextKey: IContextKey<boolean>;
Expand Down Expand Up @@ -517,6 +521,7 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE
this.searchEnabledExtensionsContextKey = SearchEnabledExtensionsContext.bindTo(contextKeyService);
this.searchDisabledExtensionsContextKey = SearchDisabledExtensionsContext.bindTo(contextKeyService);
this.hasInstalledExtensionsContextKey = HasInstalledExtensionsContext.bindTo(contextKeyService);
this.hasOutdatedExtensionsContextKey = HasOutdatedExtensionsContext.bindTo(contextKeyService);
this.builtInExtensionsContextKey = BuiltInExtensionsContext.bindTo(contextKeyService);
this.searchBuiltInExtensionsContextKey = SearchBuiltInExtensionsContext.bindTo(contextKeyService);
this.recommendedExtensionsContextKey = RecommendedExtensionsContext.bindTo(contextKeyService);
Expand Down Expand Up @@ -555,6 +560,7 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE
}, placeholder, 'extensions:searchinput', { placeholderText: placeholder, value: searchValue }));

this.updateInstalledExtensionsContexts();
this.updateOutdatedExtensionsContexts();
if (this.searchBox.getValue()) {
this.triggerSearch();
}
Expand Down Expand Up @@ -634,6 +640,7 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE

async refresh(): Promise<void> {
await this.updateInstalledExtensionsContexts();
await this.updateOutdatedExtensionsContexts();
this.doSearch(true);
if (this.configurationService.getValue(AutoCheckUpdatesConfigurationKey)) {
this.extensionsWorkbenchService.checkForUpdates();
Expand All @@ -645,6 +652,11 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE
this.hasInstalledExtensionsContextKey.set(result.some(r => !r.isBuiltin));
}

private async updateOutdatedExtensionsContexts() {
const result = await this.extensionsWorkbenchService.queryLocal();
this.hasOutdatedExtensionsContextKey.set(result.some(r => !r.outdated));
benibenj marked this conversation as resolved.
Show resolved Hide resolved
}

private triggerSearch(): void {
this.searchDelayer.trigger(() => this.doSearch(), this.searchBox && this.searchBox.getValue() ? 500 : 0).then(undefined, err => this.onError(err));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Query {
}

static suggestions(query: string): string[] {
const commands = ['installed', 'outdated', 'updates', 'enabled', 'disabled', 'builtin', 'featured', 'popular', 'recommended', 'recentlyUpdated', 'recentlyPublished', 'workspaceUnsupported', 'deprecated', 'sort', 'category', 'tag', 'ext', 'id'] as const;
const commands = ['installed', 'updates', 'enabled', 'disabled', 'builtin', 'featured', 'popular', 'recommended', 'recentlyPublished', 'workspaceUnsupported', 'deprecated', 'sort', 'category', 'tag', 'ext', 'id'] as const;
const subcommands = {
'sort': ['installs', 'rating', 'name', 'publishedDate', 'updateDate'],
'category': EXTENSION_CATEGORIES.map(c => `"${c.toLowerCase()}"`),
Expand Down