Fix forwarded ports status bar item to toggle the ports view - #320090
Conversation
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
There was a problem hiding this comment.
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
Action2implementation 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. |
alexr00
left a comment
There was a problem hiding this comment.
Thanks for the PR. Just a few comments.
|
@alexr00 ? |
alexr00
left a comment
There was a problem hiding this comment.
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?
|
@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:
My behavior was:
So I think to correlate the behavior with the problems pane, the solution we have now is equal in functionality. |
alexr00
left a comment
There was a problem hiding this comment.
That's fair. Thanks for the PR!
Previously, clicking the forwarded ports status bar entry only focused the view. Replace the built-in
~remote.forwardedPorts.focuscommand 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