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

Copy extension link #234210

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,24 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
run: async (accessor: ServicesAccessor, id: string) => accessor.get(IClipboardService).writeText(id)
});

this.registerExtensionAction({
id: 'workbench.extensions.action.copyMarketplaceLink',
title: localize2('workbench.extensions.action.copyMarketplaceLink', 'Copy Marketplace Link'),
menu: {
id: MenuId.ExtensionContext,
group: '1_copy',
when: ContextKeyExpr.and(ContextKeyExpr.not('isBuiltinExtension'), ContextKeyExpr.not('extensionDisallowInstall'), CONTEXT_HAS_WEB_SERVER),
},
run: async (accessor: ServicesAccessor, extensionId: string) => {
const clipboardService = accessor.get(IClipboardService);
const extension = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }))[0]
|| (await this.extensionsWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
if (extension && extension.url) {
await clipboardService.writeText(extension.url);
}
}
});

this.registerExtensionAction({
id: 'workbench.extensions.action.configure',
title: localize2('workbench.extensions.action.configure', 'Settings'),
Expand Down