Skip to content

Commit c7ab70d

Browse files
committed
Add Copy Extension Version action to extension context menu
1 parent c203190 commit c7ab70d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,6 +1709,23 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
17091709
run: async (accessor: ServicesAccessor, id: string) => accessor.get(IClipboardService).writeText(id)
17101710
});
17111711

1712+
this.registerExtensionAction({
1713+
id: 'workbench.extensions.action.copyExtensionVersion',
1714+
title: localize2('workbench.extensions.action.copyExtensionVersion', 'Copy Extension Version'),
1715+
menu: {
1716+
id: MenuId.ExtensionContext,
1717+
group: '1_copy'
1718+
},
1719+
run: async (accessor: ServicesAccessor, extensionId: string) => {
1720+
const clipboardService = accessor.get(IClipboardService);
1721+
const extension = this.extensionsWorkbenchService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }))[0]
1722+
|| (await this.extensionsWorkbenchService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
1723+
if (extension) {
1724+
await clipboardService.writeText(extension.version);
1725+
}
1726+
}
1727+
});
1728+
17121729
this.registerExtensionAction({
17131730
id: 'workbench.extensions.action.copyLink',
17141731
title: localize2('workbench.extensions.action.copyLink', 'Copy Link'),

0 commit comments

Comments
 (0)