Skip to content

Commit 615de73

Browse files
committed
Set correct target for ports view and polish notification
Fixes microsoft#3710, microsoft#3709
1 parent c4b0d87 commit 615de73

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

  • src/vs/workbench/contrib/remote/browser

src/vs/workbench/contrib/remote/browser/remote.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,25 +846,33 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi
846846
@INotificationService readonly notificationService: INotificationService,
847847
@IOpenerService readonly openerService: IOpenerService,
848848
@IViewsService readonly viewsService: IViewsService,
849-
@IRemoteExplorerService readonly remoteExplorerService: IRemoteExplorerService
849+
@IRemoteExplorerService readonly remoteExplorerService: IRemoteExplorerService,
850+
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
850851
) {
851852
super();
852853
const urlFinder = this._register(new UrlFinder(terminalService));
853854
this._register(urlFinder.onDidMatchLocalUrl(async (localUrl) => {
854855
const forwarded = await this.remoteExplorerService.forward(localUrl);
855856
if (forwarded) {
856857
const address = MakeAddress(forwarded.tunnelRemoteHost, forwarded.tunnelRemotePort);
857-
const message = nls.localize('remote.tunnelsView.automaticForward', "{0} has been forwarded to {1} locally.",
858+
const message = nls.localize('remote.tunnelsView.automaticForward', "{0} from the remote has been forwarded to {1} locally.",
858859
address, forwarded.localAddress);
859860
const browserChoice: IPromptChoice = {
860861
label: OpenPortInBrowserAction.LABEL,
861862
run: () => OpenPortInBrowserAction.run(this.remoteExplorerService.tunnelModel, openerService, address)
862863
};
863864
const showChoice: IPromptChoice = {
864-
label: nls.localize('remote.tunnelsView.showView', "Show Tunnels View"),
865-
run: () => viewsService.openViewContainer(VIEWLET_ID)
865+
label: nls.localize('remote.tunnelsView.showView', "Show Forwarded Ports"),
866+
run: () => {
867+
const remoteAuthority = environmentService.configuration.remoteAuthority;
868+
const explorerType: string[] | undefined = remoteAuthority ? [remoteAuthority.split('+')[0]] : undefined;
869+
if (explorerType) {
870+
remoteExplorerService.targetType = explorerType;
871+
}
872+
viewsService.openViewContainer(VIEWLET_ID);
873+
}
866874
};
867-
notificationService.prompt(Severity.Info, message, [browserChoice, showChoice]);
875+
notificationService.prompt(Severity.Info, message, [browserChoice, showChoice], { neverShowAgain: { id: 'remote.tunnelsView.autoForwardNeverShow', isSecondary: true } });
868876
}
869877
}));
870878
}

0 commit comments

Comments
 (0)