Fix dipose "method not implemented" errors in MainThread API classes (#15257)

This commit is contained in:
Charles Gagnon
2021-04-28 09:39:04 -07:00
committed by GitHub
parent 2cf15b51f9
commit 57cd25fab9
4 changed files with 14 additions and 22 deletions

View File

@@ -7,9 +7,10 @@ import { MainThreadDashboardWebviewShape, SqlMainContext, ExtHostDashboardWebvie
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { IDashboardViewService, IDashboardWebview } from 'sql/platform/dashboard/browser/dashboardViewService';
import { Disposable } from 'vs/base/common/lifecycle';
@extHostNamedCustomer(SqlMainContext.MainThreadDashboardWebview)
export class MainThreadDashboardWebview implements MainThreadDashboardWebviewShape {
export class MainThreadDashboardWebview extends Disposable implements MainThreadDashboardWebviewShape {
private static _handlePool = 0;
private readonly _proxy: ExtHostDashboardWebviewsShape;
@@ -21,8 +22,9 @@ export class MainThreadDashboardWebview implements MainThreadDashboardWebviewSha
context: IExtHostContext,
@IDashboardViewService viewService: IDashboardViewService
) {
super();
this._proxy = context.getProxy(SqlExtHostContext.ExtHostDashboardWebviews);
viewService.onRegisteredWebview(e => {
this._register(viewService.onRegisteredWebview(e => {
if (this.knownWidgets.find(x => x === e.id)) {
let handle = MainThreadDashboardWebview._handlePool++;
this._dialogs.set(handle, e);
@@ -31,11 +33,7 @@ export class MainThreadDashboardWebview implements MainThreadDashboardWebviewSha
this._proxy.$onMessage(handle, e);
});
}
});
}
public dispose(): void {
throw new Error('Method not implemented.');
}));
}
$sendMessage(handle: number, message: string) {

View File

@@ -11,9 +11,10 @@ import { MainThreadModalDialogShape, SqlMainContext, SqlExtHostContext, ExtHostM
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Disposable } from 'vs/base/common/lifecycle';
@extHostNamedCustomer(SqlMainContext.MainThreadModalDialog)
export class MainThreadModalDialog implements MainThreadModalDialogShape {
export class MainThreadModalDialog extends Disposable implements MainThreadModalDialogShape {
private readonly _proxy: ExtHostModalDialogsShape;
private readonly _dialogs = new Map<number, WebViewDialog>();
@@ -21,13 +22,10 @@ export class MainThreadModalDialog implements MainThreadModalDialogShape {
context: IExtHostContext,
@IInstantiationService private readonly _instantiationService: IInstantiationService
) {
super();
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModalDialogs);
}
dispose(): void {
throw new Error('Method not implemented.');
}
$createDialog(handle: number): void {
const dialog = this._instantiationService.createInstance(WebViewDialog);

View File

@@ -20,9 +20,10 @@ import { assign } from 'vs/base/common/objects';
import { TelemetryView, TelemetryAction } from 'sql/platform/telemetry/common/telemetryKeys';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import { IEditorInput, IEditorPane } from 'vs/workbench/common/editor';
import { Disposable } from 'vs/base/common/lifecycle';
@extHostNamedCustomer(SqlMainContext.MainThreadModelViewDialog)
export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape {
export class MainThreadModelViewDialog extends Disposable implements MainThreadModelViewDialogShape {
private readonly _proxy: ExtHostModelViewDialogShape;
private readonly _dialogs = new Map<number, Dialog>();
private readonly _tabs = new Map<number, DialogTab>();
@@ -40,14 +41,11 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
@IEditorService private _editorService: IEditorService,
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService
) {
super();
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModelViewDialog);
this._dialogService = new CustomDialogService(_instatiationService);
}
public dispose(): void {
throw new Error('Method not implemented.');
}
public $openEditor(handle: number, modelViewId: string, title: string, name?: string, options?: azdata.ModelViewEditorOptions, position?: vscode.ViewColumn): Thenable<void> {
return new Promise<void>((resolve, reject) => {
let saveHandler: ModeViewSaveHandler = options && options.supportsSave ? (h) => this.handleSave(h) : undefined;

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import {
@@ -20,23 +20,21 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
import { TaskRegistry } from 'sql/workbench/services/tasks/browser/tasksRegistry';
@extHostNamedCustomer(SqlMainContext.MainThreadTasks)
export class MainThreadTasks implements MainThreadTasksShape {
export class MainThreadTasks extends Disposable implements MainThreadTasksShape {
private readonly _disposables = new Map<string, IDisposable>();
private readonly _generateCommandsDocumentationRegistration: IDisposable;
private readonly _proxy: ExtHostTasksShape;
constructor(
extHostContext: IExtHostContext
) {
super();
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostTasks);
}
dispose() {
this._disposables.forEach(value => value.dispose());
this._disposables.clear();
this._generateCommandsDocumentationRegistration.dispose();
}
$registerTask(id: string): Promise<any> {