Leave the local extension host running when connection is lost to the remote extension host

上级 3a9daf3e
......@@ -229,6 +229,9 @@ export function activate(context: vscode.ExtensionContext) {
}
vscode.workspace.registerRemoteAuthorityResolver('test', {
async resolve(_authority: string): Promise<vscode.ResolvedAuthority> {
setTimeout(async () => {
await vscode.window.showErrorMessage('Just a custom message.', { modal: true, useCustom: true }, 'OK', 'Great');
}, 2000);
throw vscode.RemoteAuthorityResolverError.NotAvailable('Intentional Error', true);
}
});
......
......@@ -464,7 +464,9 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
protected _onExtensionHostCrashed(extensionHost: ExtensionHostManager, code: number, signal: string | null): void {
console.error('Extension host terminated unexpectedly. Code: ', code, ' Signal: ', signal);
this._stopExtensionHosts();
if (extensionHost.kind === ExtensionHostKind.LocalProcess) {
this._stopExtensionHosts();
}
}
//#region IExtensionService
......
......@@ -57,6 +57,7 @@ export class RemoteExtensionHost extends Disposable implements IExtensionHost {
public readonly onExit: Event<[number, string | null]> = this._onExit.event;
private _protocol: PersistentProtocol | null;
private _hasLostConnection: boolean;
private _terminating: boolean;
private readonly _isExtensionDevHost: boolean;
......@@ -77,6 +78,7 @@ export class RemoteExtensionHost extends Disposable implements IExtensionHost {
super();
this.remoteAuthority = this._initDataProvider.remoteAuthority;
this._protocol = null;
this._hasLostConnection = false;
this._terminating = false;
this._register(this._lifecycleService.onShutdown(reason => this.dispose()));
......@@ -188,6 +190,11 @@ export class RemoteExtensionHost extends Disposable implements IExtensionHost {
}
private _onExtHostConnectionLost(): void {
if (this._hasLostConnection) {
// avoid re-entering this method
return;
}
this._hasLostConnection = true;
if (this._isExtensionDevHost && this._environmentService.debugExtensionHost.debugId) {
this._extensionHostDebugService.close(this._environmentService.debugExtensionHost.debugId);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册