Skip to content

Commit 35e5415

Browse files
committed
Fix context on LabelTunnelAction (microsoft#122856)
Fixes microsoft/vscode-remote-release#4996
1 parent 4868dd3 commit 35e5415

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/vs/workbench/contrib/remote/browser/tunnelView.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -965,10 +965,14 @@ namespace LabelTunnelAction {
965965
export const LABEL = nls.localize('remote.tunnel.label', "Set Port Label");
966966
export const COMMAND_ID_KEYWORD = 'label';
967967

968+
function isITunnelItem(item: any): item is ITunnelItem {
969+
return item && item.tunnelType && item.remoteHost && item.source;
970+
}
971+
968972
export function handler(): ICommandHandler {
969973
return async (accessor, arg): Promise<{ port: number, label: string } | undefined> => {
970-
const context = (arg !== undefined || arg instanceof TunnelItem) ? arg : accessor.get(IContextKeyService).getContextKeyValue(TunnelViewSelectionKeyName);
971-
if (context instanceof TunnelItem) {
974+
const context = isITunnelItem(arg) ? arg : accessor.get(IContextKeyService).getContextKeyValue<ITunnelItem | undefined>(TunnelViewSelectionKeyName);
975+
if (context) {
972976
return new Promise(resolve => {
973977
const remoteExplorerService = accessor.get(IRemoteExplorerService);
974978
const startingValue = context.name ? context.name : `${context.remotePort}`;

0 commit comments

Comments
 (0)