diff --git a/src/vs/workbench/api/common/menusExtensionPoint.ts b/src/vs/workbench/api/common/menusExtensionPoint.ts index e3d61f4295f..20ea6a87624 100644 --- a/src/vs/workbench/api/common/menusExtensionPoint.ts +++ b/src/vs/workbench/api/common/menusExtensionPoint.ts @@ -212,6 +212,11 @@ const apiMenus: IAPIMenu[] = [ key: 'ports/item/origin/inline', id: MenuId.TunnelOriginInline, description: localize('view.tunnelOriginInline', "The Ports view item origin inline menu") + }, + { + key: 'ports/item/port/inline', + id: MenuId.TunnelPortInline, + description: localize('view.tunnelPortInline', "The Ports view item port inline menu") } ]; diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index 29aa371550e..46f6c63649f 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -428,9 +428,15 @@ class ActionBarRenderer extends Disposable implements ITableRenderer action.id.toLowerCase().indexOf('label') >= 0); + if (labelActions.length > 1) { + labelActions.sort((a, b) => a.label.length - b.label.length); + labelActions.pop(); + actions = actions.filter(action => labelActions.indexOf(action) < 0); + } templateData.actionBar.push(actions, { icon: true, label: false }); if (this._actionRunner) { templateData.actionBar.actionRunner = this._actionRunner; @@ -956,6 +962,7 @@ export class TunnelPanelDescriptor implements IViewDescriptor { namespace LabelTunnelAction { export const ID = 'remote.tunnel.label'; export const LABEL = nls.localize('remote.tunnel.label', "Set Port Label"); + export const COMMAND_ID_KEYWORD = 'label'; export function handler(): ICommandHandler { return async (accessor, arg): Promise<{ port: number, label: string } | undefined> => { @@ -1429,6 +1436,16 @@ MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({ ContextKeyExpr.or(TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded), TunnelTypeContextKey.isEqualTo(TunnelType.Detected))) })); // The group 0_manage is used by extensions, so try not to change it +MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({ + group: '0_manage', + order: 1, + command: { + id: LabelTunnelAction.ID, + title: LabelTunnelAction.LABEL, + icon: labelPortIcon + }, + when: TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded) +})); MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({ group: '2_localaddress', order: 0, @@ -1485,6 +1502,7 @@ MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({ MenuRegistry.appendMenuItem(MenuId.TunnelPortInline, ({ + group: '0_manage', order: 0, command: { id: ForwardPortAction.INLINE_ID, @@ -1494,6 +1512,7 @@ MenuRegistry.appendMenuItem(MenuId.TunnelPortInline, ({ when: TunnelTypeContextKey.isEqualTo(TunnelType.Candidate) })); MenuRegistry.appendMenuItem(MenuId.TunnelPortInline, ({ + group: '0_manage', order: 1, command: { id: LabelTunnelAction.ID, @@ -1503,6 +1522,7 @@ MenuRegistry.appendMenuItem(MenuId.TunnelPortInline, ({ when: TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded) })); MenuRegistry.appendMenuItem(MenuId.TunnelPortInline, ({ + group: '0_manage', order: 2, command: { id: ClosePortAction.INLINE_ID,