@@ -54,12 +54,12 @@ import { ILabelService } from 'vs/platform/label/common/label';
54
54
import { renderFormattedText } from 'vs/base/browser/formattedTextRenderer' ;
55
55
import { IOpenerService } from 'vs/platform/opener/common/opener' ;
56
56
import { IChatResponseModel , IChatTextEditGroup } from 'vs/workbench/contrib/chat/common/chatModel' ;
57
- import { EditOperation , ISingleEditOperation } from 'vs/editor/common/core/editOperation' ;
58
57
import { TextEdit } from 'vs/editor/common/languages' ;
59
58
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService' ;
60
59
import { isEqual } from 'vs/base/common/resources' ;
61
60
import { DefaultModelSHA1Computer } from 'vs/editor/common/services/modelService' ;
62
61
import { IDialogService } from 'vs/platform/dialogs/common/dialogs' ;
62
+ import { TextModelText } from 'vs/editor/common/model/textModelText' ;
63
63
64
64
const $ = dom . $ ;
65
65
@@ -820,12 +820,8 @@ export class DefaultChatTextEditor {
820
820
return 0 ;
821
821
}
822
822
823
- const edits : ISingleEditOperation [ ] = [ ] ;
824
- for ( const item of diff . changes2 ) {
825
- const range = item . original . toExclusiveRange ( ) ;
826
- const newText = model . modified . getValueInRange ( item . modified . toExclusiveRange ( ) ) ;
827
- edits . push ( EditOperation . replace ( range , newText ) ) ;
828
- }
823
+ const modified = new TextModelText ( model . modified ) ;
824
+ const edits = diff . changes2 . map ( i => i . toRangeMapping ( ) . toTextEdit ( modified ) . toSingleEditOperation ( ) ) ;
829
825
830
826
model . original . pushStackElement ( ) ;
831
827
model . original . pushEditOperations ( null , edits , ( ) => null ) ;
0 commit comments