Skip to content

Fix tunnelProtocol context key always resolving to https on focus - #325445

Merged
Alex Ross (alexr00) merged 3 commits into
microsoft:mainfrom
UditDewan:fix-tunnel-protocol-context-key
Jul 14, 2026
Merged

Alex Ross (alexr00) merged 3 commits into
microsoft:mainfrom
UditDewan:fix-tunnel-protocol-context-key

Conversation

@UditDewan

Copy link
Copy Markdown
Contributor

In the Ports view, onFocusChanged sets the tunnelProtocol context key with a ternary whose branches are both TunnelProtocol.Https, so the key reports https for every focused tunnel regardless of its actual protocol:

this.tunnelProtocolContext.set(item.protocol === TunnelProtocol.Https ? TunnelProtocol.Https : TunnelProtocol.Https);

This looks like a typo introduced in a414bf2 when the protocol handling was reworked. The context menu path (onContextMenu) sets the key from node.protocol directly, so right-click menus behave, but anything that reads tunnelProtocol after a plain focus or selection change (keybinding and menu when clauses, the HTTP/HTTPS toggle state in the Change Port Protocol submenu) sees https even for HTTP tunnels.

The fix makes the else branch return TunnelProtocol.Http, which matches the key's declared default and the intent of the original normalization.

Copilot AI review requested due to automatic review settings July 11, 2026 19:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@alexr00 Alex Ross (alexr00) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR

@alexr00
Alex Ross (alexr00) enabled auto-merge (squash) July 13, 2026 10:11
@alexr00
Alex Ross (alexr00) merged commit fb5e582 into microsoft:main Jul 14, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.130.0 milestone Jul 14, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Aug 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

4 participants