From 391bca591eda22ce9daead3ca9e8838715335891 Mon Sep 17 00:00:00 2001 From: rebornix Date: Mon, 10 Aug 2020 14:30:19 -0700 Subject: [PATCH] re #104262. add log for execution and cancel. --- .../api/browser/mainThreadNotebook.ts | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/vs/workbench/api/browser/mainThreadNotebook.ts b/src/vs/workbench/api/browser/mainThreadNotebook.ts index ba8c89315d1..ceed17dc7b2 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebook.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebook.ts @@ -474,10 +474,10 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo await this._proxy.$resolveNotebookEditor(viewType, uri, editorId); }, executeNotebookByAttachedKernel: async (viewType: string, uri: URI) => { - return this.executeNotebookByAttachedKernel(viewType, uri); + return this.executeNotebookByAttachedKernel(viewType, uri, undefined); }, cancelNotebookByAttachedKernel: async (viewType: string, uri: URI) => { - return this.cancelNotebookByAttachedKernel(viewType, uri); + return this.cancelNotebookByAttachedKernel(viewType, uri, undefined); }, onDidReceiveMessage: (editorId: string, rendererType: string | undefined, message: unknown) => { this._proxy.$onDidReceiveMessage(editorId, rendererType, message); @@ -486,10 +486,10 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo return this.removeNotebookTextModel(uri); }, executeNotebookCell: async (uri: URI, handle: number) => { - return this._proxy.$executeNotebookByAttachedKernel(_viewType, uri, handle); + return this.executeNotebookByAttachedKernel(_viewType, uri, handle); }, cancelNotebookCell: async (uri: URI, handle: number) => { - return this._proxy.$cancelNotebookByAttachedKernel(_viewType, uri, handle); + return this.cancelNotebookByAttachedKernel(_viewType, uri, handle); }, save: async (uri: URI, token: CancellationToken) => { return this._proxy.$saveNotebook(_viewType, uri, token); @@ -519,7 +519,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo } async $registerNotebookKernel(extension: NotebookExtensionDescription, id: string, label: string, selectors: (string | IRelativePattern)[], preloads: UriComponents[]): Promise { - const kernel = new MainThreadNotebookKernel(this._proxy, id, label, selectors, extension.id, URI.revive(extension.location), preloads.map(preload => URI.revive(preload))); + const kernel = new MainThreadNotebookKernel(this._proxy, id, label, selectors, extension.id, URI.revive(extension.location), preloads.map(preload => URI.revive(preload)), this.logService); this._notebookKernels.set(id, kernel); this._notebookService.registerNotebookKernel(kernel); return; @@ -552,9 +552,11 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo return that._proxy.$resolveNotebookKernel(handle, editorId, uri, kernelId, token); }, executeNotebook: (uri: URI, kernelId: string, cellHandle: number | undefined) => { + this.logService.debug('MainthreadNotebooks.registerNotebookKernelProvider#executeNotebook', uri.path, kernelId, cellHandle); return that._proxy.$executeNotebookKernelFromProvider(handle, uri, kernelId, cellHandle); }, cancelNotebook: (uri: URI, kernelId: string, cellHandle: number | undefined) => { + this.logService.debug('MainthreadNotebooks.registerNotebookKernelProvider#cancelNotebook', uri.path, kernelId, cellHandle); return that._proxy.$cancelNotebookKernelFromProvider(handle, uri, kernelId, cellHandle); }, }); @@ -611,12 +613,14 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo } } - async executeNotebookByAttachedKernel(viewType: string, uri: URI): Promise { - return this._proxy.$executeNotebookByAttachedKernel(viewType, uri, undefined); + async executeNotebookByAttachedKernel(viewType: string, uri: URI, handle: number | undefined): Promise { + this.logService.debug('MainthreadNotebooks#executeNotebookByAttachedKernel', uri.path, handle); + return this._proxy.$executeNotebookByAttachedKernel(viewType, uri, handle); } - async cancelNotebookByAttachedKernel(viewType: string, uri: URI): Promise { - return this._proxy.$cancelNotebookByAttachedKernel(viewType, uri, undefined); + async cancelNotebookByAttachedKernel(viewType: string, uri: URI, handle: number | undefined): Promise { + this.logService.debug('MainthreadNotebooks#cancelNotebookByAttachedKernel', uri.path, handle); + return this._proxy.$cancelNotebookByAttachedKernel(viewType, uri, handle); } async $postMessage(editorId: string, forRendererId: string | undefined, value: any): Promise { @@ -655,11 +659,13 @@ export class MainThreadNotebookKernel implements INotebookKernelInfo { readonly selectors: (string | IRelativePattern)[], readonly extension: ExtensionIdentifier, readonly extensionLocation: URI, - readonly preloads: URI[] + readonly preloads: URI[], + readonly logService: ILogService ) { } async executeNotebook(viewType: string, uri: URI, handle: number | undefined): Promise { + this.logService.debug('MainThreadNotebookKernel#executeNotebook', uri.path, handle); return this._proxy.$executeNotebook2(this.id, viewType, uri, handle); } }