@@ -134,17 +134,14 @@ export class InlineChatController implements IEditorContribution {
134
134
}
135
135
136
136
this . _log ( 'session RESUMING' , e ) ;
137
- console . log ( 'before calling create session of the constructor' ) ;
138
137
await this . _nextState ( State . CREATE_SESSION , { existingSession } ) ;
139
138
this . _log ( 'session done or paused' ) ;
140
139
} ) ) ;
141
140
this . _log ( 'NEW controller' ) ;
142
141
}
143
142
144
143
dispose ( ) : void {
145
- console . log ( 'inside of dispose' ) ;
146
144
this . _stashedSession . clear ( ) ;
147
- console . log ( 'inside of dispose before calling finishExistingSession' ) ;
148
145
this . finishExistingSession ( ) ;
149
146
this . _store . dispose ( ) ;
150
147
this . _log ( 'controller disposed' ) ;
@@ -221,18 +218,6 @@ export class InlineChatController implements IEditorContribution {
221
218
}
222
219
223
220
private async [ State . CREATE_SESSION ] ( options : InlineChatRunOptions ) : Promise < State . CANCEL | State . INIT_UI | State . PAUSE > {
224
- console . log ( 'inside of CREATE_SESSION' ) ;
225
- console . log ( 'inside of CREATE_SESSION, this._activeSession : ' , this . _activeSession ) ;
226
- // if (this._activeSession) {
227
- // console.log('inside of CREATE_SESSION, before clearing the session store');
228
- // this._sessionStore.clear();
229
- // console.log('inside of CREATE_SESSION, before releasing the session');
230
- // this._inlineChatSessionService.releaseSession(this._activeSession);
231
- // console.log('inside of CREATE_SESSION, before calling pause');
232
- // // Doesn't appear to be properly awaited?
233
- // await this[State.PAUSE]();
234
- // }
235
- console . log ( 'inside of CREATE_SESSION, this._activeSession after the cleaning : ' , this . _activeSession ) ;
236
221
assertType ( this . _activeSession === undefined ) ;
237
222
assertType ( this . _editor . hasModel ( ) ) ;
238
223
@@ -245,7 +230,6 @@ export class InlineChatController implements IEditorContribution {
245
230
if ( ! session ) {
246
231
const createSessionCts = new CancellationTokenSource ( ) ;
247
232
const msgListener = Event . once ( this . _messages . event ) ( m => {
248
- console . log ( 'inside of CREATE_SESSION, inside of the msgListener code of CREATE_SESSION' ) ;
249
233
this . _log ( 'state=_createSession) message received' , m ) ;
250
234
if ( m === Message . ACCEPT_INPUT ) {
251
235
// user accepted the input before having a session
@@ -297,8 +281,6 @@ export class InlineChatController implements IEditorContribution {
297
281
}
298
282
299
283
private async [ State . INIT_UI ] ( options : InlineChatRunOptions ) : Promise < State . WAIT_FOR_INPUT | State . SHOW_RESPONSE | State . APPLY_RESPONSE > {
300
- console . log ( 'inside of init ui' ) ;
301
- console . log ( 'inside of INIT_UI, this._activeSession : ' , this . _activeSession ) ;
302
284
assertType ( this . _activeSession ) ;
303
285
304
286
// hide/cancel inline completions when invoking IE
@@ -359,20 +341,16 @@ export class InlineChatController implements IEditorContribution {
359
341
360
342
if ( editIsOutsideOfWholeRange ) {
361
343
this . _log ( 'text changed outside of whole range, FINISH session' ) ;
362
- console . log ( 'inside of INIT_UI, before calling finish existing session' ) ;
363
344
this . finishExistingSession ( ) ;
364
345
}
365
346
} ) ) ;
366
347
367
348
if ( ! this . _activeSession . lastExchange ) {
368
- console . log ( 'inside of INIT_UI,before waiting for input' ) ;
369
349
return State . WAIT_FOR_INPUT ;
370
350
} else if ( options . isUnstashed ) {
371
351
delete options . isUnstashed ;
372
- console . log ( 'inside of INIT_UI,before apply response' ) ;
373
352
return State . APPLY_RESPONSE ;
374
353
} else {
375
- console . log ( 'inside of INIT_UI,before show response' ) ;
376
354
return State . SHOW_RESPONSE ;
377
355
}
378
356
}
@@ -391,9 +369,7 @@ export class InlineChatController implements IEditorContribution {
391
369
}
392
370
393
371
394
- private async [ State . WAIT_FOR_INPUT ] ( options : InlineChatRunOptions ) : Promise < void | State . ACCEPT | State . CANCEL | State . PAUSE | State . WAIT_FOR_INPUT | State . MAKE_REQUEST > {
395
- console . log ( 'inside of wait for input' ) ;
396
-
372
+ private async [ State . WAIT_FOR_INPUT ] ( options : InlineChatRunOptions ) : Promise < State . ACCEPT | State . CANCEL | State . PAUSE | State . WAIT_FOR_INPUT | State . MAKE_REQUEST > {
397
373
assertType ( this . _activeSession ) ;
398
374
assertType ( this . _strategy ) ;
399
375
@@ -414,7 +390,6 @@ export class InlineChatController implements IEditorContribution {
414
390
} else {
415
391
const barrier = new Barrier ( ) ;
416
392
const msgListener = Event . once ( this . _messages . event ) ( m => {
417
- console . log ( 'inside of WAIT_FOR_INPUT, inside of msgListener' ) ;
418
393
this . _log ( 'state=_waitForInput) message received' , m ) ;
419
394
message = m ;
420
395
barrier . open ( ) ;
@@ -426,17 +401,11 @@ export class InlineChatController implements IEditorContribution {
426
401
this . _zone . value . widget . selectAll ( ) ;
427
402
428
403
if ( message & ( Message . CANCEL_INPUT | Message . CANCEL_SESSION ) ) {
429
- console . log ( 'inside of WAIT_FOR_INPUT,entered into the case when message cancel session' ) ;
430
- await this [ State . CANCEL ] ( ) ;
431
- return ;
432
- // return State.CANCEL;
404
+ return State . CANCEL ;
433
405
}
434
406
435
407
if ( message & Message . ACCEPT_SESSION ) {
436
- console . log ( 'inside of WAIT_FOR_INPUT,entered into the case when message accept' ) ;
437
- await this [ State . ACCEPT ] ( ) ;
438
- return ;
439
- // return State.ACCEPT;
408
+ return State . ACCEPT ;
440
409
}
441
410
442
411
if ( message & Message . PAUSE_SESSION ) {
@@ -488,7 +457,6 @@ export class InlineChatController implements IEditorContribution {
488
457
489
458
let message = Message . NONE ;
490
459
const msgListener = Event . once ( this . _messages . event ) ( m => {
491
- console . log ( 'inside of MAKE_REQUEST, inside of msgListener of MAKE REQUEST' ) ;
492
460
this . _log ( 'state=_makeRequest) message received' , m ) ;
493
461
message = m ;
494
462
requestCts . cancel ( ) ;
@@ -543,12 +511,10 @@ export class InlineChatController implements IEditorContribution {
543
511
this . _activeSession . addExchange ( new SessionExchange ( this . _activeSession . lastInput , response ) ) ;
544
512
545
513
if ( message & Message . CANCEL_SESSION ) {
546
- console . log ( 'inside of MAKE_REQUEST, cancelling the session' ) ;
547
514
return State . CANCEL ;
548
515
} else if ( message & Message . PAUSE_SESSION ) {
549
516
return State . PAUSE ;
550
517
} else if ( message & Message . ACCEPT_SESSION ) {
551
- console . log ( 'inside of MAKE_REQUEST, accepting' ) ;
552
518
return State . ACCEPT ;
553
519
} else {
554
520
return State . APPLY_RESPONSE ;
@@ -664,8 +630,6 @@ export class InlineChatController implements IEditorContribution {
664
630
665
631
private async [ State . PAUSE ] ( ) {
666
632
667
- console . log ( 'entered into pause state' ) ;
668
-
669
633
this . _ctxDidEdit . reset ( ) ;
670
634
this . _ctxUserDidEdit . reset ( ) ;
671
635
this . _ctxLastResponseType . reset ( ) ;
@@ -685,35 +649,24 @@ export class InlineChatController implements IEditorContribution {
685
649
}
686
650
687
651
private async [ State . ACCEPT ] ( ) {
688
- console . log ( 'inside of State.ACCEPT' ) ;
689
652
assertType ( this . _activeSession ) ;
690
653
assertType ( this . _strategy ) ;
691
654
this . _sessionStore . clear ( ) ;
692
- console . log ( 'inside of State.ACCEPT, after assert type' ) ;
693
655
694
656
try {
695
- console . log ( 'inside of State.ACCEPT, before strategy apply' ) ;
696
657
await this . _strategy . apply ( ) ;
697
- console . log ( 'inside of State.ACCEPT, after strategy apply' ) ;
698
- // TODO: ASK WHY DESPITE AWAIT, AFTER STRATEFY NOT PRINTED BEFORE CREATE SESSION
699
658
} catch ( err ) {
700
- console . log ( 'inside of State.ACCEPT, when error obtained' ) ;
701
659
this . _dialogService . error ( localize ( 'err.apply' , "Failed to apply changes." , toErrorMessage ( err ) ) ) ;
702
660
this . _log ( 'FAILED to apply changes' ) ;
703
661
this . _log ( err ) ;
704
662
}
705
663
706
- console . log ( 'inside of State.ACCEPT, before release session' ) ;
707
-
708
- await this . _inlineChatSessionService . releaseSession ( this . _activeSession ) ;
664
+ this . _inlineChatSessionService . releaseSession ( this . _activeSession ) ;
709
665
710
- console . log ( 'inside of State.ACCEPT, before state pause' ) ;
711
- await this [ State . PAUSE ] ( ) ;
666
+ this [ State . PAUSE ] ( ) ;
712
667
}
713
668
714
669
private async [ State . CANCEL ] ( ) {
715
- console . log ( 'inside of cancel the session' ) ;
716
-
717
670
assertType ( this . _activeSession ) ;
718
671
assertType ( this . _strategy ) ;
719
672
this . _sessionStore . clear ( ) ;
@@ -728,14 +681,13 @@ export class InlineChatController implements IEditorContribution {
728
681
this . _log ( err ) ;
729
682
}
730
683
731
- await this [ State . PAUSE ] ( ) ;
684
+ this [ State . PAUSE ] ( ) ;
732
685
733
686
this . _stashedSession . clear ( ) ;
734
687
if ( ! mySession . isUnstashed && mySession . lastExchange ) {
735
688
// only stash sessions that had edits
736
689
this . _stashedSession . value = this . _instaService . createInstance ( StashedSession , this . _editor , mySession ) ;
737
690
} else {
738
- console . log ( 'before releasing the session of cancel' ) ;
739
691
this . _inlineChatSessionService . releaseSession ( mySession ) ;
740
692
}
741
693
}
@@ -815,13 +767,10 @@ export class InlineChatController implements IEditorContribution {
815
767
}
816
768
817
769
acceptSession ( ) : void {
818
- console . log ( 'inside of acceptSession method' ) ;
819
- // Will fire a message which will be picked up by the controller and some other code will be run
820
770
this . _messages . fire ( Message . ACCEPT_SESSION ) ;
821
771
}
822
772
823
773
cancelSession ( ) {
824
- console . log ( 'inside of cancelSession' ) ;
825
774
let result : string | undefined ;
826
775
if ( this . _strategy && this . _activeSession ) {
827
776
const changedText = this . _activeSession . asChangedText ( ) ;
@@ -836,21 +785,15 @@ export class InlineChatController implements IEditorContribution {
836
785
}
837
786
838
787
finishExistingSession ( ) : void {
839
- console . log ( 'inside of finish existing session' ) ;
840
- console . log ( this . _activeSession ) ;
841
788
if ( this . _activeSession ) {
842
789
if ( this . _activeSession . editMode === EditMode . Preview ) {
843
790
this . _log ( 'finishing existing session, using CANCEL' , this . _activeSession . editMode ) ;
844
- console . log ( 'before cancelling inside of finish existing session' ) ;
845
791
this . cancelSession ( ) ;
846
792
} else {
847
793
this . _log ( 'finishing existing session, using APPLY' , this . _activeSession . editMode ) ;
848
- console . log ( 'before accepting inside of finish existing session' ) ;
849
794
this . acceptSession ( ) ;
850
795
}
851
-
852
796
}
853
- console . log ( 'at the end of finish existing session' ) ;
854
797
}
855
798
856
799
unstashLastSession ( ) : Session | undefined {
@@ -879,7 +822,6 @@ class StashedSession {
879
822
this . _ctxHasStashedSession . set ( true ) ;
880
823
this . _listener = Event . once ( Event . any ( editor . onDidChangeCursorSelection , editor . onDidChangeModelContent , editor . onDidChangeModel ) ) ( ( ) => {
881
824
this . _session = undefined ;
882
- console . log ( 'before release session of constructor' ) ;
883
825
this . _sessionService . releaseSession ( session ) ;
884
826
this . _ctxHasStashedSession . reset ( ) ;
885
827
} ) ;
@@ -889,7 +831,6 @@ class StashedSession {
889
831
this . _listener . dispose ( ) ;
890
832
this . _ctxHasStashedSession . reset ( ) ;
891
833
if ( this . _session ) {
892
- console . log ( 'before release session of dispose' ) ;
893
834
this . _sessionService . releaseSession ( this . _session ) ;
894
835
}
895
836
}
0 commit comments