mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Re-resolve webview views when extension host restarts
Fixes #108555 Previously webviews were left hanging when the extension host died. With this change, we now try to re-create them once the extension host restarts
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { MainThreadWebviews, reviveWebviewExtension } from 'vs/workbench/api/browser/mainThreadWebviews';
|
||||
import * as extHostProtocol from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IWebviewViewService, WebviewView } from 'vs/workbench/contrib/webviewView/browser/webviewViewService';
|
||||
@@ -28,6 +28,15 @@ export class MainThreadWebviewsViews extends Disposable implements extHostProtoc
|
||||
this._proxy = context.getProxy(extHostProtocol.ExtHostContext.ExtHostWebviewViews);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
super.dispose();
|
||||
|
||||
dispose(this._webviewViewProviders.values());
|
||||
this._webviewViewProviders.clear();
|
||||
|
||||
dispose(this._webviewViews.values());
|
||||
}
|
||||
|
||||
public $setWebviewViewTitle(handle: extHostProtocol.WebviewHandle, value: string | undefined): void {
|
||||
const webviewView = this.getWebviewView(handle);
|
||||
webviewView.title = value;
|
||||
@@ -54,7 +63,7 @@ export class MainThreadWebviewsViews extends Disposable implements extHostProtoc
|
||||
|
||||
const extension = reviveWebviewExtension(extensionData);
|
||||
|
||||
this._webviewViewService.register(viewType, {
|
||||
const registration = this._webviewViewService.register(viewType, {
|
||||
resolve: async (webviewView: WebviewView, cancellation: CancellationToken) => {
|
||||
const handle = webviewView.webview.id;
|
||||
|
||||
@@ -93,6 +102,8 @@ export class MainThreadWebviewsViews extends Disposable implements extHostProtoc
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this._webviewViewProviders.set(viewType, registration);
|
||||
}
|
||||
|
||||
public $unregisterWebviewViewProvider(viewType: string): void {
|
||||
|
||||
Reference in New Issue
Block a user