From d18f310cfe483fb26014a40b0d5ea3943c9fd448 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Fri, 23 Oct 2020 13:13:30 +0200 Subject: [PATCH] Fix port forwarding sequencing issues --- .../contrib/remote/browser/remoteExplorer.ts | 13 +++++++------ .../workbench/contrib/remote/browser/tunnelView.ts | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts b/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts index 6606f904b46..5ccb9b03723 100644 --- a/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts +++ b/src/vs/workbench/contrib/remote/browser/remoteExplorer.ts @@ -64,14 +64,15 @@ export class ForwardedPortsView extends Disposable implements IWorkbenchContribu } private enableBadgeAndStatusBar() { - this._register(this.remoteExplorerService.tunnelModel.onForwardPort(() => { - this.updateStatusBar(); - })); - this._register(this.remoteExplorerService.tunnelModel.onClosePort(() => { - this.updateStatusBar(); - })); const disposable = Registry.as(Extensions.ViewsRegistry).onViewsRegistered(e => { if (e.find(view => view.views.find(viewDescriptor => viewDescriptor.id === TUNNEL_VIEW_ID))) { + this._register(this.remoteExplorerService.tunnelModel.onForwardPort(() => { + this.updateStatusBar(); + })); + this._register(this.remoteExplorerService.tunnelModel.onClosePort(() => { + this.updateStatusBar(); + })); + this.updateStatusBar(); disposable.dispose(); } diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts index 0d5fc5b958b..fde246bfd50 100644 --- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts +++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts @@ -414,7 +414,8 @@ class TunnelItem implements ITunnelItem { if (address.length < 15) { return address; } - return new URL(address).host ?? address; + const host = new URL(address).host; + return host.length > 0 ? host : address; } set description(description: string | undefined) { -- GitLab