mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 10:19:02 +00:00
committed by
GitHub
parent
acba36e955
commit
d2316317da
@@ -719,7 +719,7 @@ export function registerChatActions() {
|
|||||||
|
|
||||||
override async run(accessor: ServicesAccessor): Promise<void> {
|
override async run(accessor: ServicesAccessor): Promise<void> {
|
||||||
const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);
|
||||||
extensionsWorkbenchService.openSearch(`@feature:${CopilotUsageExtensionFeatureId}`);
|
extensionsWorkbenchService.openSearch(`@contribute:${CopilotUsageExtensionFeatureId}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1207,7 +1207,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
|
|||||||
this.registerExtensionAction({
|
this.registerExtensionAction({
|
||||||
id: `extensions.sort.${id}`,
|
id: `extensions.sort.${id}`,
|
||||||
title,
|
title,
|
||||||
precondition: ContextKeyExpr.and(precondition, ContextKeyExpr.regex(ExtensionsSearchValueContext.key, /^@feature:/).negate(), sortCapabilityContext),
|
precondition: ContextKeyExpr.and(precondition, ContextKeyExpr.regex(ExtensionsSearchValueContext.key, /^@contribute:/).negate(), sortCapabilityContext),
|
||||||
menu: [{
|
menu: [{
|
||||||
id: extensionsSortSubMenu,
|
id: extensionsSortSubMenu,
|
||||||
when: ContextKeyExpr.and(ContextKeyExpr.or(CONTEXT_HAS_GALLERY, DefaultViewsContext), sortCapabilityContext),
|
when: ContextKeyExpr.and(ContextKeyExpr.or(CONTEXT_HAS_GALLERY, DefaultViewsContext), sortCapabilityContext),
|
||||||
|
|||||||
@@ -400,12 +400,8 @@ export class ExtensionsListView extends AbstractExtensionsListView<IExtension> {
|
|||||||
extensions = this.filterRecentlyUpdatedExtensions(local, query, options);
|
extensions = this.filterRecentlyUpdatedExtensions(local, query, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (/@feature:/i.test(query.value)) {
|
else if (/@contribute:/i.test(query.value)) {
|
||||||
const result = this.filterExtensionsByFeature(local, query);
|
extensions = this.filterExtensionsByFeature(local, query);
|
||||||
if (result) {
|
|
||||||
extensions = result.extensions;
|
|
||||||
description = result.description;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (includeBuiltin) {
|
else if (includeBuiltin) {
|
||||||
@@ -665,12 +661,12 @@ export class ExtensionsListView extends AbstractExtensionsListView<IExtension> {
|
|||||||
return this.sortExtensions(result, options);
|
return this.sortExtensions(result, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
private filterExtensionsByFeature(local: IExtension[], query: Query): { extensions: IExtension[]; description: string } | undefined {
|
private filterExtensionsByFeature(local: IExtension[], query: Query): IExtension[] {
|
||||||
const value = query.value.replace(/@feature:/g, '').trim();
|
const value = query.value.replace(/@contribute:/g, '').trim();
|
||||||
const featureId = value.split(' ')[0];
|
const featureId = value.split(' ')[0];
|
||||||
const feature = Registry.as<IExtensionFeaturesRegistry>(Extensions.ExtensionFeaturesRegistry).getExtensionFeature(featureId);
|
const feature = Registry.as<IExtensionFeaturesRegistry>(Extensions.ExtensionFeaturesRegistry).getExtensionFeature(featureId);
|
||||||
if (!feature) {
|
if (!feature) {
|
||||||
return undefined;
|
return [];
|
||||||
}
|
}
|
||||||
if (this.extensionsViewState) {
|
if (this.extensionsViewState) {
|
||||||
this.extensionsViewState.filters.featureId = featureId;
|
this.extensionsViewState.filters.featureId = featureId;
|
||||||
@@ -688,10 +684,7 @@ export class ExtensionsListView extends AbstractExtensionsListView<IExtension> {
|
|||||||
result.push([e, accessData?.accessTimes.length ?? 0]);
|
result.push([e, accessData?.accessTimes.length ?? 0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return result.sort(([, a], [, b]) => b - a).map(([e]) => e);
|
||||||
extensions: result.sort(([, a], [, b]) => b - a).map(([e]) => e),
|
|
||||||
description: localize('showingExtensionsForFeature', "Extensions using {0} in the last 30 days", feature.label)
|
|
||||||
};
|
|
||||||
} finally {
|
} finally {
|
||||||
renderer?.dispose();
|
renderer?.dispose();
|
||||||
}
|
}
|
||||||
@@ -1262,7 +1255,7 @@ export class ExtensionsListView extends AbstractExtensionsListView<IExtension> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isFeatureExtensionsQuery(query: string): boolean {
|
static isFeatureExtensionsQuery(query: string): boolean {
|
||||||
return /@feature:/i.test(query);
|
return /@contribute:/i.test(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
override focus(): void {
|
override focus(): void {
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
import { IExtensionGalleryManifest } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.js';
|
import { IExtensionGalleryManifest } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.js';
|
||||||
import { FilterType, SortBy } from '../../../../platform/extensionManagement/common/extensionManagement.js';
|
import { FilterType, SortBy } from '../../../../platform/extensionManagement/common/extensionManagement.js';
|
||||||
import { EXTENSION_CATEGORIES } from '../../../../platform/extensions/common/extensions.js';
|
import { EXTENSION_CATEGORIES } from '../../../../platform/extensions/common/extensions.js';
|
||||||
|
import { Registry } from '../../../../platform/registry/common/platform.js';
|
||||||
|
import { Extensions, IExtensionFeaturesRegistry } from '../../../services/extensionManagement/common/extensionFeatures.js';
|
||||||
|
|
||||||
export class Query {
|
export class Query {
|
||||||
|
|
||||||
@@ -15,7 +17,7 @@ export class Query {
|
|||||||
|
|
||||||
static suggestions(query: string, galleryManifest: IExtensionGalleryManifest | null): string[] {
|
static suggestions(query: string, galleryManifest: IExtensionGalleryManifest | null): string[] {
|
||||||
|
|
||||||
const commands = ['installed', 'updates', 'enabled', 'disabled', 'builtin'];
|
const commands = ['installed', 'updates', 'enabled', 'disabled', 'builtin', 'contribute'];
|
||||||
if (galleryManifest?.capabilities.extensionQuery?.filtering?.some(c => c.name === FilterType.Featured)) {
|
if (galleryManifest?.capabilities.extensionQuery?.filtering?.some(c => c.name === FilterType.Featured)) {
|
||||||
commands.push('featured');
|
commands.push('featured');
|
||||||
}
|
}
|
||||||
@@ -36,12 +38,18 @@ export class Query {
|
|||||||
}
|
}
|
||||||
sortCommands.push('name', 'publishedDate', 'updateDate');
|
sortCommands.push('name', 'publishedDate', 'updateDate');
|
||||||
|
|
||||||
|
const contributeCommands = [];
|
||||||
|
for (const feature of Registry.as<IExtensionFeaturesRegistry>(Extensions.ExtensionFeaturesRegistry).getExtensionFeatures()) {
|
||||||
|
contributeCommands.push(feature.id);
|
||||||
|
}
|
||||||
|
|
||||||
const subcommands = {
|
const subcommands = {
|
||||||
'sort': sortCommands,
|
'sort': sortCommands,
|
||||||
'category': isCategoriesEnabled ? EXTENSION_CATEGORIES.map(c => `"${c.toLowerCase()}"`) : [],
|
'category': isCategoriesEnabled ? EXTENSION_CATEGORIES.map(c => `"${c.toLowerCase()}"`) : [],
|
||||||
'tag': [''],
|
'tag': [''],
|
||||||
'ext': [''],
|
'ext': [''],
|
||||||
'id': ['']
|
'id': [''],
|
||||||
|
'contribute': contributeCommands
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
const queryContains = (substr: string) => query.indexOf(substr) > -1;
|
const queryContains = (substr: string) => query.indexOf(substr) > -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user