3
3
4
4
'use strict' ;
5
5
6
- import { KernelMessage } from '@jupyterlab/services' ;
7
6
import { NotebookCell , NotebookCellRunState , NotebookDocument } from 'vscode' ;
8
7
import { IApplicationShell , ICommandManager , IVSCodeNotebook } from '../../../common/application/types' ;
9
8
import { IDisposable } from '../../../common/types' ;
10
9
import { noop } from '../../../common/utils/misc' ;
11
10
import { IInterpreterService } from '../../../interpreter/contracts' ;
12
11
import { captureTelemetry } from '../../../telemetry' ;
13
12
import { Commands , Telemetry , VSCodeNativeTelemetry } from '../../constants' ;
14
- import { handleUpdateDisplayDataMessage } from '../../notebook/helpers/executionHelpers' ;
15
13
import { MultiCancellationTokenSource } from '../../notebook/helpers/multiCancellationToken' ;
16
14
import { INotebookContentProvider } from '../../notebook/types' ;
17
15
import { IDataScienceErrorHandler , INotebook , INotebookEditorProvider } from '../../types' ;
@@ -169,17 +167,6 @@ export class KernelExecution implements IDisposable {
169
167
return kernel ;
170
168
}
171
169
172
- private async onIoPubMessage ( document : NotebookDocument , msg : KernelMessage . IIOPubMessage ) {
173
- // tslint:disable-next-line:no-require-imports
174
- const jupyterLab = require ( '@jupyterlab/services' ) as typeof import ( '@jupyterlab/services' ) ;
175
- const editor = this . vscNotebook . notebookEditors . find ( ( e ) => e . document === document ) ;
176
- if ( jupyterLab . KernelMessage . isUpdateDisplayDataMsg ( msg ) && editor ) {
177
- if ( await handleUpdateDisplayDataMessage ( msg , editor ) ) {
178
- this . contentProvider . notifyChangesToDocument ( document ) ;
179
- }
180
- }
181
- }
182
-
183
170
private async executeIndividualCell (
184
171
kernelPromise : Promise < IKernel > ,
185
172
cellExecution : CellExecution
@@ -188,20 +175,9 @@ export class KernelExecution implements IDisposable {
188
175
throw new Error ( 'No notebook object' ) ;
189
176
}
190
177
191
- // Register for IO pub messages
192
- const ioRegistration = this . notebook . session . onIoPubMessage (
193
- this . onIoPubMessage . bind ( this , cellExecution . cell . notebook )
194
- ) ;
195
178
cellExecution . token . onCancellationRequested (
196
- ( ) => {
197
- ioRegistration . dispose ( ) ;
198
- if ( cellExecution . completed ) {
199
- return ;
200
- }
201
-
202
- // Interrupt kernel only if we need to cancel a cell execution.
203
- this . commandManager . executeCommand ( Commands . NotebookEditorInterruptKernel ) . then ( noop , noop ) ;
204
- } ,
179
+ // Interrupt kernel only if we need to cancel a cell execution.
180
+ ( ) => this . commandManager . executeCommand ( Commands . NotebookEditorInterruptKernel ) . then ( noop , noop ) ,
205
181
this ,
206
182
this . disposables
207
183
) ;
@@ -210,11 +186,7 @@ export class KernelExecution implements IDisposable {
210
186
await cellExecution . start ( kernelPromise , this . notebook ) ;
211
187
212
188
// The result promise will resolve when complete.
213
- try {
214
- return await cellExecution . result ;
215
- } finally {
216
- ioRegistration . dispose ( ) ;
217
- }
189
+ return cellExecution . result ;
218
190
}
219
191
220
192
private async validateKernel ( document : NotebookDocument ) : Promise < void > {
0 commit comments