diff --git a/src/vs/workbench/contrib/remote/browser/remote.ts b/src/vs/workbench/contrib/remote/browser/remote.ts index 069249ebda96479b5c8eeb82ae7d0e4f4e662545..3f5443776f57735fa3167fb29922a20a0752e24e 100644 --- a/src/vs/workbench/contrib/remote/browser/remote.ts +++ b/src/vs/workbench/contrib/remote/browser/remote.ts @@ -841,6 +841,8 @@ class RemoteAgentConnectionStatusListener implements IWorkbenchContribution { } class AutomaticPortForwarding extends Disposable implements IWorkbenchContribution { + private contextServiceListener: IDisposable; + constructor( @ITerminalService private readonly terminalService: ITerminalService, @INotificationService private readonly notificationService: INotificationService, @@ -854,12 +856,20 @@ class AutomaticPortForwarding extends Disposable implements IWorkbenchContributi if (this.environmentService.configuration.remoteAuthority) { this.startUrlFinder(); } + this.contextServiceListener = this._register(this.contextKeyService.onDidChangeContext(e => { + if (e.affectsSome(new Set(forwardedPortsViewEnabled.keys()))) { + this.startUrlFinder(); + } + })); } + private isStarted = false; private startUrlFinder() { - if (!forwardedPortsViewEnabled.getValue(this.contextKeyService)) { + if (!this.isStarted && !forwardedPortsViewEnabled.getValue(this.contextKeyService)) { return; } + this.contextServiceListener.dispose(); + this.isStarted = true; const urlFinder = this._register(new UrlFinder(this.terminalService)); this._register(urlFinder.onDidMatchLocalUrl(async (localUrl) => { const forwarded = await this.remoteExplorerService.forward(localUrl); diff --git a/src/vs/workbench/contrib/remote/browser/urlFinder.ts b/src/vs/workbench/contrib/remote/browser/urlFinder.ts index d0ee06fd48bcefd05e37b827dd5388245b749fbc..2962235ee70c7739d176fb0f4538be677a3863f6 100644 --- a/src/vs/workbench/contrib/remote/browser/urlFinder.ts +++ b/src/vs/workbench/contrib/remote/browser/urlFinder.ts @@ -63,6 +63,10 @@ export class UrlFinder extends Disposable { if (host !== '0.0.0.0' && host !== '127.0.0.1') { host = 'localhost'; } + // Exclude node inspect, except when using defualt port + if (port !== 9229 && data.startsWith('Debugger listening on')) { + return; + } this._onDidMatchLocalUrl.fire({ port, host }); } }