Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/vs/workbench/contrib/remote/browser/remote.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,38 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { localize } from '../../../../nls.js';
import { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js';
import { IWorkbenchContributionsRegistry, WorkbenchPhase, Extensions as WorkbenchExtensions, registerWorkbenchContribution2 } from '../../../common/contributions.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { ShowCandidateContribution } from './showCandidate.js';
import { LifecyclePhase } from '../../../services/lifecycle/common/lifecycle.js';
import { TunnelFactoryContribution } from './tunnelFactory.js';
import { RemoteAgentConnectionStatusListener, RemoteMarkers } from './remote.js';
import { RemoteStatusIndicator } from './remoteIndicator.js';
import { AutomaticPortForwarding, ForwardedPortsView, PortRestore } from './remoteExplorer.js';
import { AutomaticPortForwarding, ForwardedPortsView, PortRestore, TOGGLE_VIEW_ACTION_ID } from './remoteExplorer.js';
import { InitialRemoteConnectionHealthContribution } from './remoteConnectionHealth.js';
import { IViewsService } from '../../../services/views/common/viewsService.js';
import { TUNNEL_VIEW_ID } from '../../../services/remote/common/remoteExplorerService.js';
import { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';

registerAction2(class extends Action2 {
constructor() {
super({
id: TOGGLE_VIEW_ACTION_ID,
title: localize('remote.togglePortsView', "Toggle Forwarded Ports View"),
});
}

async run(accessor: ServicesAccessor): Promise<void> {
const viewsService = accessor.get(IViewsService);
if (viewsService.isViewVisible(TUNNEL_VIEW_ID)) {
viewsService.closeView(TUNNEL_VIEW_ID);
} else {
await viewsService.openView(TUNNEL_VIEW_ID, true);
}
}
Comment thread
thernstig marked this conversation as resolved.
});

const workbenchContributionsRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
registerWorkbenchContribution2(ShowCandidateContribution.ID, ShowCandidateContribution, WorkbenchPhase.BlockRestore);
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/contrib/remote/browser/remoteExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { IPreferencesService } from '../../../services/preferences/common/prefer
import { IStorageService, StorageScope } from '../../../../platform/storage/common/storage.js';

export const VIEWLET_ID = 'workbench.view.remote';
export const TOGGLE_VIEW_ACTION_ID = 'remoteExplorer.toggleForwardedPortsView';

export class ForwardedPortsView extends Disposable implements IWorkbenchContribution {
private readonly contextKeyListener = this._register(new MutableDisposable<IDisposable>());
Expand Down Expand Up @@ -166,7 +167,7 @@ export class ForwardedPortsView extends Disposable implements IWorkbenchContribu
text: `$(radio-tower) ${text}`,
ariaLabel: tooltip,
tooltip,
command: `${TUNNEL_VIEW_ID}.focus`
command: TOGGLE_VIEW_ACTION_ID
};
}
}
Expand Down
Loading