@@ -59,6 +59,8 @@ export abstract class EditModeStrategy {
59
59
this . _onDidDiscard . dispose ( ) ;
60
60
}
61
61
62
+ abstract start ( ) : Promise < void > ;
63
+
62
64
abstract apply ( ) : Promise < void > ;
63
65
64
66
abstract cancel ( ) : Promise < void > ;
@@ -102,6 +104,10 @@ export class PreviewStrategy extends EditModeStrategy {
102
104
super . dispose ( ) ;
103
105
}
104
106
107
+ async start ( ) {
108
+ // nothing to do
109
+ }
110
+
105
111
async apply ( ) {
106
112
107
113
if ( ! ( this . _session . lastExchange ?. response instanceof ReplyResponse ) ) {
@@ -280,6 +286,10 @@ export class LiveStrategy extends EditModeStrategy {
280
286
this . _inlineDiffDecorations . visible = this . _diffEnabled ;
281
287
}
282
288
289
+ async start ( ) {
290
+ // nothing to do
291
+ }
292
+
283
293
async apply ( ) {
284
294
if ( this . _editCount > 0 ) {
285
295
this . _editor . pushUndoStop ( ) ;
@@ -637,22 +647,27 @@ export class LiveStrategy3 extends EditModeStrategy {
637
647
}
638
648
639
649
override dispose ( ) : void {
640
- this . _ctxCurrentChangeHasDiff . reset ( ) ;
641
- this . _ctxCurrentChangeShowsDiff . reset ( ) ;
642
- this . _modifiedRangesDecorations . clear ( ) ;
650
+ this . _resetDiff ( ) ;
643
651
this . _previewZone . rawValue ?. dispose ( ) ;
644
- this . _sessionStore . dispose ( ) ;
645
652
this . _store . dispose ( ) ;
646
653
super . dispose ( ) ;
647
654
}
648
655
649
-
650
- async apply ( ) {
656
+ private _resetDiff ( ) : void {
651
657
this . _ctxCurrentChangeHasDiff . reset ( ) ;
652
658
this . _ctxCurrentChangeShowsDiff . reset ( ) ;
653
659
this . _sessionStore . clear ( ) ;
654
660
this . _modifiedRangesDecorations . clear ( ) ;
655
661
this . _modifiedRangesThatHaveBeenInteractedWith . length = 0 ;
662
+ this . _zone . widget . updateStatus ( '' ) ;
663
+ }
664
+
665
+ async start ( ) {
666
+ this . _resetDiff ( ) ;
667
+ }
668
+
669
+ async apply ( ) {
670
+ this . _resetDiff ( ) ;
656
671
if ( this . _editCount > 0 ) {
657
672
this . _editor . pushUndoStop ( ) ;
658
673
}
@@ -666,11 +681,7 @@ export class LiveStrategy3 extends EditModeStrategy {
666
681
}
667
682
668
683
async cancel ( ) {
669
- this . _ctxCurrentChangeHasDiff . reset ( ) ;
670
- this . _ctxCurrentChangeShowsDiff . reset ( ) ;
671
- this . _sessionStore . clear ( ) ;
672
- this . _modifiedRangesDecorations . clear ( ) ;
673
- this . _modifiedRangesThatHaveBeenInteractedWith . length = 0 ;
684
+ this . _resetDiff ( ) ;
674
685
const { textModelN : modelN , textModelNAltVersion, textModelNSnapshotAltVersion } = this . _session ;
675
686
if ( modelN . isDisposed ( ) ) {
676
687
return ;
0 commit comments