@@ -176,15 +176,17 @@ export class InlineChatController implements IEditorContribution {
176
176
return this . _zone . value . position ;
177
177
}
178
178
179
+ private _currentRun ?: Promise < void > ;
180
+
179
181
async run ( options : InlineChatRunOptions | undefined = { } ) : Promise < void > {
180
- this . _log ( 'session starting inside of run' ) ;
181
- console . log ( 'before finishExistingSession inside of run' ) ;
182
- await this . finishExistingSession ( ) ;
183
- console . log ( 'after finish existing session inside of run' ) ;
182
+ this . finishExistingSession ( ) ;
183
+ if ( this . _currentRun ) {
184
+ await this . _currentRun ;
185
+ }
184
186
this . _stashedSession . clear ( ) ;
185
- console . log ( 'before calling create session inside of run' ) ;
186
- await this . _nextState ( State . CREATE_SESSION , options ) ;
187
- this . _log ( 'session done or paused' ) ;
187
+ this . _currentRun = this . _nextState ( State . CREATE_SESSION , options ) ;
188
+ await this . _currentRun ;
189
+ this . _currentRun = undefined ;
188
190
}
189
191
190
192
// ---- state machine
@@ -833,7 +835,7 @@ export class InlineChatController implements IEditorContribution {
833
835
return result ;
834
836
}
835
837
836
- async finishExistingSession ( ) : Promise < void > {
838
+ finishExistingSession ( ) : void {
837
839
console . log ( 'inside of finish existing session' ) ;
838
840
console . log ( this . _activeSession ) ;
839
841
if ( this . _activeSession ) {
@@ -846,6 +848,7 @@ export class InlineChatController implements IEditorContribution {
846
848
console . log ( 'before accepting inside of finish existing session' ) ;
847
849
this . acceptSession ( ) ;
848
850
}
851
+
849
852
}
850
853
console . log ( 'at the end of finish existing session' ) ;
851
854
}
0 commit comments