Skip to content

Commit

Permalink
Fix context on LabelTunnelAction (#122856)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 authored May 4, 2021
1 parent 5913f53 commit 85f8ebf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/vs/workbench/contrib/remote/browser/tunnelView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -965,10 +965,14 @@ namespace LabelTunnelAction {
export const LABEL = nls.localize('remote.tunnel.label', "Set Port Label");
export const COMMAND_ID_KEYWORD = 'label';

function isITunnelItem(item: any): item is ITunnelItem {
return item && item.tunnelType && item.remoteHost && item.source;
}

export function handler(): ICommandHandler {
return async (accessor, arg): Promise<{ port: number, label: string } | undefined> => {
const context = (arg !== undefined || arg instanceof TunnelItem) ? arg : accessor.get(IContextKeyService).getContextKeyValue(TunnelViewSelectionKeyName);
if (context instanceof TunnelItem) {
const context = isITunnelItem(arg) ? arg : accessor.get(IContextKeyService).getContextKeyValue<ITunnelItem | undefined>(TunnelViewSelectionKeyName);
if (context) {
return new Promise(resolve => {
const remoteExplorerService = accessor.get(IRemoteExplorerService);
const startingValue = context.name ? context.name : `${context.remotePort}`;
Expand Down

0 comments on commit 85f8ebf

Please sign in to comment.