re #104262. add log for execution and cancel.

This commit is contained in:
rebornix 2020-08-10 14:30:19 -07:00
parent 03467e96ff
commit 391bca591e

View file

@ -474,10 +474,10 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
await this._proxy.$resolveNotebookEditor(viewType, uri, editorId); await this._proxy.$resolveNotebookEditor(viewType, uri, editorId);
}, },
executeNotebookByAttachedKernel: async (viewType: string, uri: URI) => { executeNotebookByAttachedKernel: async (viewType: string, uri: URI) => {
return this.executeNotebookByAttachedKernel(viewType, uri); return this.executeNotebookByAttachedKernel(viewType, uri, undefined);
}, },
cancelNotebookByAttachedKernel: async (viewType: string, uri: URI) => { 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) => { onDidReceiveMessage: (editorId: string, rendererType: string | undefined, message: unknown) => {
this._proxy.$onDidReceiveMessage(editorId, rendererType, message); this._proxy.$onDidReceiveMessage(editorId, rendererType, message);
@ -486,10 +486,10 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
return this.removeNotebookTextModel(uri); return this.removeNotebookTextModel(uri);
}, },
executeNotebookCell: async (uri: URI, handle: number) => { 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) => { 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) => { save: async (uri: URI, token: CancellationToken) => {
return this._proxy.$saveNotebook(_viewType, uri, token); 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<void> { async $registerNotebookKernel(extension: NotebookExtensionDescription, id: string, label: string, selectors: (string | IRelativePattern)[], preloads: UriComponents[]): Promise<void> {
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._notebookKernels.set(id, kernel);
this._notebookService.registerNotebookKernel(kernel); this._notebookService.registerNotebookKernel(kernel);
return; return;
@ -552,9 +552,11 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
return that._proxy.$resolveNotebookKernel(handle, editorId, uri, kernelId, token); return that._proxy.$resolveNotebookKernel(handle, editorId, uri, kernelId, token);
}, },
executeNotebook: (uri: URI, kernelId: string, cellHandle: number | undefined) => { 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); return that._proxy.$executeNotebookKernelFromProvider(handle, uri, kernelId, cellHandle);
}, },
cancelNotebook: (uri: URI, kernelId: string, cellHandle: number | undefined) => { 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); 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<void> { async executeNotebookByAttachedKernel(viewType: string, uri: URI, handle: number | undefined): Promise<void> {
return this._proxy.$executeNotebookByAttachedKernel(viewType, uri, undefined); this.logService.debug('MainthreadNotebooks#executeNotebookByAttachedKernel', uri.path, handle);
return this._proxy.$executeNotebookByAttachedKernel(viewType, uri, handle);
} }
async cancelNotebookByAttachedKernel(viewType: string, uri: URI): Promise<void> { async cancelNotebookByAttachedKernel(viewType: string, uri: URI, handle: number | undefined): Promise<void> {
return this._proxy.$cancelNotebookByAttachedKernel(viewType, uri, undefined); 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<boolean> { async $postMessage(editorId: string, forRendererId: string | undefined, value: any): Promise<boolean> {
@ -655,11 +659,13 @@ export class MainThreadNotebookKernel implements INotebookKernelInfo {
readonly selectors: (string | IRelativePattern)[], readonly selectors: (string | IRelativePattern)[],
readonly extension: ExtensionIdentifier, readonly extension: ExtensionIdentifier,
readonly extensionLocation: URI, readonly extensionLocation: URI,
readonly preloads: URI[] readonly preloads: URI[],
readonly logService: ILogService
) { ) {
} }
async executeNotebook(viewType: string, uri: URI, handle: number | undefined): Promise<void> { async executeNotebook(viewType: string, uri: URI, handle: number | undefined): Promise<void> {
this.logService.debug('MainThreadNotebookKernel#executeNotebook', uri.path, handle);
return this._proxy.$executeNotebook2(this.id, viewType, uri, handle); return this._proxy.$executeNotebook2(this.id, viewType, uri, handle);
} }
} }