Skip to content

Fix forwarded ports status bar item to toggle the ports view - #320090

Merged
alexr00 merged 5 commits into
microsoft:mainfrom
thernstig:toggle-forwarded-ports
Jul 27, 2026
Merged

Fix forwarded ports status bar item to toggle the ports view#320090
alexr00 merged 5 commits into
microsoft:mainfrom
thernstig:toggle-forwarded-ports

Conversation

@thernstig

Copy link
Copy Markdown
Contributor

Previously, clicking the forwarded ports status bar entry only focused the view. Replace the built-in ~remote.forwardedPorts.focus command with a proper toggle action that closes the view when it is already visible, matching the behavior of the Problems status bar item.

Also extracts constants into common/remoteExplorer.ts and browser/messages.ts following the same pattern as the Markers contribution.

Fixes #320086

Previously, clicking the forwarded ports status bar entry only
focused the view. Replace the built-in `~remote.forwardedPorts.focus`
command with a proper toggle action that closes the view when it is
already visible, matching the behavior of the Problems status bar item.

Also extracts constants into common/remoteExplorer.ts and
browser/messages.ts following the same pattern as the Markers
contribution.

Fixes microsoft#320086
Copilot AI review requested due to automatic review settings June 5, 2026 12:21

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR introduces a dedicated action/command for toggling the Forwarded Ports (tunnel) view and wires it into the Forwarded Ports status UI.

Changes:

  • Adds a shared action ID for toggling the Forwarded Ports view.
  • Updates the Forwarded Ports status item command to use the new action.
  • Registers a new Action2 implementation to open/close the tunnel view and adds a localized label resource.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/vs/workbench/contrib/remote/common/remoteExplorer.ts Adds a shared action ID constant for toggling the Forwarded Ports view.
src/vs/workbench/contrib/remote/browser/remoteExplorer.ts Switches the status item command to the new toggle action.
src/vs/workbench/contrib/remote/browser/remote.contribution.ts Registers the toggle action and implements open/close behavior via IViewsService.
src/vs/workbench/contrib/remote/browser/messages.ts Adds a localized label used as the action title.

Comment thread src/vs/workbench/contrib/remote/browser/remote.contribution.ts
Comment thread src/vs/workbench/contrib/remote/browser/messages.ts Outdated
Comment thread src/vs/workbench/contrib/remote/browser/messages.ts Outdated

@alexr00 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.

Thanks for the PR. Just a few comments.

Comment thread src/vs/workbench/contrib/remote/browser/messages.ts Outdated
Comment thread src/vs/workbench/contrib/remote/common/remoteExplorer.ts Outdated
@thernstig

Copy link
Copy Markdown
Contributor Author

@alexr00 ?

@alexr00 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.

While testing this out, I noticed we already have an automatically created command "View: Toggle Ports" (~remote.forwardedPortsContainer). Can we just re-used that command ID and not have a new command at all?

@thernstig

Copy link
Copy Markdown
Contributor Author

@alexr00 are you sure that one is the same in behavior if I use it?

I checked around and believe it works differently. I had an AI summarize the thoughts:

The built-in command behind "View: Toggle Ports" is not a pure toggle. It is a panel-container command, and for panel containers its behavior is:

  • If Ports is not the visible panel, open Ports and focus it.
  • If Ports is visible but the panel itself does not currently have focus, keep it open and move focus into the panel.
  • Only if Ports is visible and the panel already has focus, close the panel.

My behavior was:

  • If Ports is visible, close it.
  • If Ports is not visible, open it.
  • Focus state does not matter.

So I think to correlate the behavior with the problems pane, the solution we have now is equal in functionality.

@alexr00 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.

That's fair. Thanks for the PR!

@alexr00
alexr00 merged commit ddca764 into microsoft:main Jul 27, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.132.0 milestone Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make status bar Forwarded Ports toggleable

4 participants