提交 b67b5e8e 编写于 作者: A Alex Ross

Exclude node inspect from auto port forwarding

Fixes #107243
上级 73084f5c
......@@ -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);
......
......@@ -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 });
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册