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 { IDataScienceErrorHandler , INotebook , INotebookEditorProvider } from '../../types' ;
17
15
import { CellExecution , CellExecutionFactory } from './cellExecution' ;
@@ -161,15 +159,6 @@ export class KernelExecution implements IDisposable {
161
159
return kernel ;
162
160
}
163
161
164
- private async onIoPubMessage ( document : NotebookDocument , msg : KernelMessage . IIOPubMessage ) {
165
- // tslint:disable-next-line:no-require-imports
166
- const jupyterLab = require ( '@jupyterlab/services' ) as typeof import ( '@jupyterlab/services' ) ;
167
- const editor = this . vscNotebook . notebookEditors . find ( ( e ) => e . document === document ) ;
168
- if ( jupyterLab . KernelMessage . isUpdateDisplayDataMsg ( msg ) && editor ) {
169
- await handleUpdateDisplayDataMessage ( msg , editor ) ;
170
- }
171
- }
172
-
173
162
private async executeIndividualCell (
174
163
kernelPromise : Promise < IKernel > ,
175
164
cellExecution : CellExecution
@@ -178,20 +167,9 @@ export class KernelExecution implements IDisposable {
178
167
throw new Error ( 'No notebook object' ) ;
179
168
}
180
169
181
- // Register for IO pub messages
182
- const ioRegistration = this . notebook . session . onIoPubMessage (
183
- this . onIoPubMessage . bind ( this , cellExecution . cell . notebook )
184
- ) ;
185
170
cellExecution . token . onCancellationRequested (
186
- ( ) => {
187
- ioRegistration . dispose ( ) ;
188
- if ( cellExecution . completed ) {
189
- return ;
190
- }
191
-
192
- // Interrupt kernel only if we need to cancel a cell execution.
193
- this . commandManager . executeCommand ( Commands . NotebookEditorInterruptKernel ) . then ( noop , noop ) ;
194
- } ,
171
+ // Interrupt kernel only if we need to cancel a cell execution.
172
+ ( ) => this . commandManager . executeCommand ( Commands . NotebookEditorInterruptKernel ) . then ( noop , noop ) ,
195
173
this ,
196
174
this . disposables
197
175
) ;
@@ -200,11 +178,7 @@ export class KernelExecution implements IDisposable {
200
178
await cellExecution . start ( kernelPromise , this . notebook ) ;
201
179
202
180
// The result promise will resolve when complete.
203
- try {
204
- return await cellExecution . result ;
205
- } finally {
206
- ioRegistration . dispose ( ) ;
207
- }
181
+ return cellExecution . result ;
208
182
}
209
183
210
184
private async validateKernel ( document : NotebookDocument ) : Promise < void > {
0 commit comments