@@ -27,7 +27,6 @@ import {
27
27
} from '../../notebook/helpers/helpers' ;
28
28
import { MultiCancellationTokenSource } from '../../notebook/helpers/multiCancellationToken' ;
29
29
import { NotebookEditor } from '../../notebook/notebookEditor' ;
30
- import { INotebookContentProvider } from '../../notebook/types' ;
31
30
import {
32
31
IDataScienceErrorHandler ,
33
32
IJupyterSession ,
@@ -41,7 +40,6 @@ const vscodeNotebookEnums = require('vscode') as typeof import('vscode-proposed'
41
40
42
41
export class CellExecutionFactory {
43
42
constructor (
44
- private readonly contentProvider : INotebookContentProvider ,
45
43
private readonly errorHandler : IDataScienceErrorHandler ,
46
44
private readonly editorProvider : INotebookEditorProvider ,
47
45
private readonly appShell : IApplicationShell ,
@@ -53,7 +51,6 @@ export class CellExecutionFactory {
53
51
return CellExecution . fromCell (
54
52
this . vscNotebook . notebookEditors . find ( ( e ) => e . document === cell . notebook ) ! ,
55
53
cell ,
56
- this . contentProvider ,
57
54
this . errorHandler ,
58
55
this . editorProvider ,
59
56
this . appShell
@@ -104,7 +101,6 @@ export class CellExecution {
104
101
private constructor (
105
102
public readonly editor : VSCNotebookEditor ,
106
103
public readonly cell : NotebookCell ,
107
- private readonly contentProvider : INotebookContentProvider ,
108
104
private readonly errorHandler : IDataScienceErrorHandler ,
109
105
private readonly editorProvider : INotebookEditorProvider ,
110
106
private readonly applicationService : IApplicationShell
@@ -116,12 +112,11 @@ export class CellExecution {
116
112
public static fromCell (
117
113
editor : VSCNotebookEditor ,
118
114
cell : NotebookCell ,
119
- contentProvider : INotebookContentProvider ,
120
115
errorHandler : IDataScienceErrorHandler ,
121
116
editorProvider : INotebookEditorProvider ,
122
117
appService : IApplicationShell
123
118
) {
124
- return new CellExecution ( editor , cell , contentProvider , errorHandler , editorProvider , appService ) ;
119
+ return new CellExecution ( editor , cell , errorHandler , editorProvider , appService ) ;
125
120
}
126
121
127
122
public async start ( kernelPromise : Promise < IKernel > , notebook : INotebook ) {
@@ -136,8 +131,6 @@ export class CellExecution {
136
131
} ) ;
137
132
} ) ;
138
133
this . stopWatch . reset ( ) ;
139
- // Changes to metadata must be saved in ipynb, hence mark doc has dirty.
140
- this . contentProvider . notifyChangesToDocument ( this . cell . notebook ) ;
141
134
this . notifyCellExecution ( ) ;
142
135
143
136
// Begin the request that will modify our cell.
@@ -182,13 +175,10 @@ export class CellExecution {
182
175
} )
183
176
) ;
184
177
await updateCellWithErrorStatus ( this . editor , this . cell , error ) ;
185
- this . contentProvider . notifyChangesToDocument ( this . cell . notebook ) ;
186
178
this . errorHandler . handleError ( ( error as unknown ) as Error ) . ignoreErrors ( ) ;
187
179
188
180
this . _completed = true ;
189
181
this . _result . resolve ( this . cell . metadata . runState ) ;
190
- // Changes to metadata must be saved in ipynb, hence mark doc has dirty.
191
- this . contentProvider . notifyChangesToDocument ( this . cell . notebook ) ;
192
182
}
193
183
194
184
private async completedSuccessfully ( ) {
@@ -222,8 +212,6 @@ export class CellExecution {
222
212
223
213
this . _completed = true ;
224
214
this . _result . resolve ( this . cell . metadata . runState ) ;
225
- // Changes to metadata must be saved in ipynb, hence mark doc has dirty.
226
- this . contentProvider . notifyChangesToDocument ( this . cell . notebook ) ;
227
215
}
228
216
229
217
/**
@@ -258,8 +246,6 @@ export class CellExecution {
258
246
) ;
259
247
this . _completed = true ;
260
248
this . _result . resolve ( this . cell . metadata . runState ) ;
261
- // Changes to metadata must be saved in ipynb, hence mark doc has dirty.
262
- this . contentProvider . notifyChangesToDocument ( this . cell . notebook ) ;
263
249
}
264
250
265
251
/**
@@ -273,7 +259,6 @@ export class CellExecution {
273
259
runState : vscodeNotebookEnums . NotebookCellRunState . Running
274
260
} )
275
261
) ;
276
- this . contentProvider . notifyChangesToDocument ( this . cell . notebook ) ;
277
262
}
278
263
279
264
private sendPerceivedCellExecute ( ) {
@@ -371,8 +356,6 @@ export class CellExecution {
371
356
// tslint:disable-next-line:no-require-imports
372
357
const jupyterLab = require ( '@jupyterlab/services' ) as typeof import ( '@jupyterlab/services' ) ;
373
358
374
- // Keep track of we need to send an update to VS code or not.
375
- let shouldUpdate = true ;
376
359
try {
377
360
if ( jupyterLab . KernelMessage . isExecuteResultMsg ( msg ) ) {
378
361
await this . handleExecuteResult ( msg as KernelMessage . IExecuteResultMsg , clearState ) ;
@@ -382,28 +365,23 @@ export class CellExecution {
382
365
// Status is handled by the result promise. While it is running we are active. Otherwise we're stopped.
383
366
// So ignore status messages.
384
367
const statusMsg = msg as KernelMessage . IStatusMsg ;
385
- shouldUpdate = false ;
386
368
this . handleStatusMessage ( statusMsg , clearState ) ;
387
369
} else if ( jupyterLab . KernelMessage . isStreamMsg ( msg ) ) {
388
370
await this . handleStreamMessage ( msg as KernelMessage . IStreamMsg , clearState ) ;
389
371
} else if ( jupyterLab . KernelMessage . isDisplayDataMsg ( msg ) ) {
390
372
await this . handleDisplayData ( msg as KernelMessage . IDisplayDataMsg , clearState ) ;
391
- } else if ( jupyterLab . KernelMessage . isUpdateDisplayDataMsg ( msg ) ) {
392
- // No new data to update UI, hence do not send updates.
393
- shouldUpdate = false ;
394
373
} else if ( jupyterLab . KernelMessage . isClearOutputMsg ( msg ) ) {
395
374
await this . handleClearOutput ( msg as KernelMessage . IClearOutputMsg , clearState ) ;
396
375
} else if ( jupyterLab . KernelMessage . isErrorMsg ( msg ) ) {
397
376
await this . handleError ( msg as KernelMessage . IErrorMsg , clearState ) ;
377
+ } else if ( jupyterLab . KernelMessage . isUpdateDisplayDataMsg ( msg ) ) {
378
+ // Noop.
398
379
} else if ( jupyterLab . KernelMessage . isCommOpenMsg ( msg ) ) {
399
- // No new data to update UI, hence do not send updates.
400
- shouldUpdate = false ;
380
+ // Noop.
401
381
} else if ( jupyterLab . KernelMessage . isCommMsgMsg ( msg ) ) {
402
- // No new data to update UI, hence do not send updates.
403
- shouldUpdate = false ;
382
+ // Noop.
404
383
} else if ( jupyterLab . KernelMessage . isCommCloseMsg ( msg ) ) {
405
- // No new data to update UI, hence do not send updates.
406
- shouldUpdate = false ;
384
+ // Noop.
407
385
} else {
408
386
traceWarning ( `Unknown message ${ msg . header . msg_type } : hasData=${ 'data' in msg . content } ` ) ;
409
387
}
@@ -412,11 +390,6 @@ export class CellExecution {
412
390
if ( 'execution_count' in msg . content && typeof msg . content . execution_count === 'number' ) {
413
391
updateCellExecutionCount ( this . editor , this . cell , msg . content . execution_count ) . then ( noop , noop ) ;
414
392
}
415
-
416
- // Show our update if any new output.
417
- if ( shouldUpdate ) {
418
- this . contentProvider . notifyChangesToDocument ( this . cell . notebook ) ;
419
- }
420
393
} catch ( err ) {
421
394
// If not a restart error, then tell the subscriber
422
395
this . completedWithErrors ( err ) . then ( noop , noop ) ;
@@ -588,9 +561,6 @@ export class CellExecution {
588
561
if ( 'execution_count' in msg . content && typeof msg . content . execution_count === 'number' ) {
589
562
await updateCellExecutionCount ( this . editor , this . cell , msg . content . execution_count ) ;
590
563
}
591
-
592
- // Send this event.
593
- this . contentProvider . notifyChangesToDocument ( this . cell . notebook ) ;
594
564
}
595
565
}
596
566
}
0 commit comments