File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/vs/workbench/contrib/remote/browser Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -965,10 +965,14 @@ namespace LabelTunnelAction {
965
965
export const LABEL = nls . localize ( 'remote.tunnel.label' , "Set Port Label" ) ;
966
966
export const COMMAND_ID_KEYWORD = 'label' ;
967
967
968
+ function isITunnelItem ( item : any ) : item is ITunnelItem {
969
+ return item && item . tunnelType && item . remoteHost && item . source ;
970
+ }
971
+
968
972
export function handler ( ) : ICommandHandler {
969
973
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 ) {
972
976
return new Promise ( resolve => {
973
977
const remoteExplorerService = accessor . get ( IRemoteExplorerService ) ;
974
978
const startingValue = context . name ? context . name : `${ context . remotePort } ` ;
You can’t perform that action at this time.
0 commit comments