@@ -13,7 +13,6 @@ import {
13
13
Event ,
14
14
EventEmitter ,
15
15
NotebookCell ,
16
- NotebookCellRunState ,
17
16
NotebookDocument ,
18
17
Uri
19
18
} from 'vscode' ;
@@ -82,8 +81,8 @@ export class Kernel implements IKernel {
82
81
private readonly launchTimeout : number ,
83
82
commandManager : ICommandManager ,
84
83
interpreterService : IInterpreterService ,
85
- errorHandler : IDataScienceErrorHandler ,
86
- private readonly contentProvider : INotebookContentProvider ,
84
+ private readonly errorHandler : IDataScienceErrorHandler ,
85
+ contentProvider : INotebookContentProvider ,
87
86
editorProvider : INotebookEditorProvider ,
88
87
private readonly kernelProvider : IKernelProvider ,
89
88
private readonly kernelSelectionUsage : IKernelSelectionUsage ,
@@ -101,13 +100,6 @@ export class Kernel implements IKernel {
101
100
) ;
102
101
}
103
102
public async executeCell ( cell : NotebookCell ) : Promise < void > {
104
- // Update cell to running state if cell has any code
105
- if ( cell . document . getText ( ) . trim ( ) . length > 0 ) {
106
- cell . metadata . runState = NotebookCellRunState . Running ;
107
- this . contentProvider . notifyChangesToDocument ( cell . notebook ) ;
108
- }
109
-
110
- // Then actually start.
111
103
await this . start ( { disableUI : false , token : this . startCancellation . token } ) ;
112
104
await this . kernelExecution . executeCell ( cell ) ;
113
105
}
@@ -146,7 +138,12 @@ export class Kernel implements IKernel {
146
138
147
139
this . _notebookPromise
148
140
. then ( ( nb ) => ( this . kernelExecution . notebook = this . notebook = nb ) )
149
- . catch ( ( ex ) => traceError ( 'failed to create INotebook in kernel' , ex ) ) ;
141
+ . catch ( ( ex ) => {
142
+ traceError ( 'failed to create INotebook in kernel' , ex ) ;
143
+ this . _notebookPromise = undefined ;
144
+ this . startCancellation . cancel ( ) ;
145
+ this . errorHandler . handleError ( ex ) . ignoreErrors ( ) ; // Just a notification, so don't await this
146
+ } ) ;
150
147
await this . _notebookPromise ;
151
148
await this . initializeAfterStart ( ) ;
152
149
}
0 commit comments