@@ -206,6 +206,7 @@ export class LiveStrategy extends EditModeStrategy {
206
206
private readonly _inlineDiffDecorations : InlineDiffDecorations ;
207
207
private readonly _ctxInlineDiff : IContextKey < boolean > ;
208
208
private _lastResponse ?: EditResponse ;
209
+ private _editCount : number = 0 ;
209
210
210
211
constructor (
211
212
protected readonly _session : Session ,
@@ -255,6 +256,9 @@ export class LiveStrategy extends EditModeStrategy {
255
256
}
256
257
257
258
async apply ( ) {
259
+ if ( this . _editCount > 0 ) {
260
+ this . _editor . pushUndoStop ( ) ;
261
+ }
258
262
if ( this . _lastResponse ?. workspaceEdits ) {
259
263
await this . _bulkEditService . apply ( this . _lastResponse . workspaceEdits ) ;
260
264
}
@@ -281,7 +285,7 @@ export class LiveStrategy extends EditModeStrategy {
281
285
}
282
286
}
283
287
284
- override async makeChanges ( _response : EditResponse , edits : ISingleEditOperation [ ] ) : Promise < void > {
288
+ override async makeChanges ( _response : EditResponse , edits : ISingleEditOperation [ ] , ignoreInlineDiff ?: boolean ) : Promise < void > {
285
289
const cursorStateComputerAndInlineDiffCollection : ICursorStateComputer = ( undoEdits ) => {
286
290
let last : Position | null = null ;
287
291
for ( const edit of undoEdits ) {
@@ -291,9 +295,11 @@ export class LiveStrategy extends EditModeStrategy {
291
295
return last && [ Selection . fromPositions ( last ) ] ;
292
296
} ;
293
297
294
- this . _editor . pushUndoStop ( ) ;
295
- this . _editor . executeEdits ( 'interactive-editor-live' , edits , cursorStateComputerAndInlineDiffCollection ) ;
296
- this . _editor . pushUndoStop ( ) ;
298
+ // push undo stop before first edit
299
+ if ( ++ this . _editCount === 1 ) {
300
+ this . _editor . pushUndoStop ( ) ;
301
+ }
302
+ this . _editor . executeEdits ( 'interactive-editor-live' , edits , ignoreInlineDiff ? undefined : cursorStateComputerAndInlineDiffCollection ) ;
297
303
}
298
304
299
305
override async renderChanges ( response : EditResponse , textModel0Changes : LineRangeMapping [ ] ) {
@@ -362,9 +368,7 @@ export class LivePreviewStrategy extends LiveStrategy {
362
368
}
363
369
364
370
override async makeChanges ( _response : EditResponse , edits : ISingleEditOperation [ ] ) : Promise < void > {
365
- this . _editor . pushUndoStop ( ) ;
366
- this . _editor . executeEdits ( 'interactive-editor-livePreview' , edits ) ;
367
- this . _editor . pushUndoStop ( ) ;
371
+ super . makeChanges ( _response , edits , true ) ;
368
372
}
369
373
370
374
override async renderChanges ( response : EditResponse , changes : LineRangeMapping [ ] ) {
0 commit comments