@@ -8,6 +8,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
8
8
import { URI , UriComponents } from 'vs/base/common/uri' ;
9
9
import { CancellationTokenSource } from 'vs/base/common/cancellation' ;
10
10
import { ITextModel } from 'vs/editor/common/model' ;
11
+ import { Range } from 'vs/editor/common/core/range' ;
11
12
import { ISelection } from 'vs/editor/common/core/selection' ;
12
13
import { ILanguageService } from 'vs/editor/common/languages/language' ;
13
14
import { localize } from 'vs/nls' ;
@@ -30,6 +31,7 @@ import { Schemas } from 'vs/base/common/network';
30
31
import { IDebugService } from 'vs/workbench/contrib/debug/common/debug' ;
31
32
import { IInteractiveEditorRequest , IInteractiveEditorService } from 'vs/workbench/contrib/interactiveEditor/common/interactiveEditor' ;
32
33
import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange' ;
34
+ import { EditOperation } from 'vs/editor/common/core/editOperation' ;
33
35
34
36
const EXECUTE_NOTEBOOK_COMMAND_ID = 'notebook.execute' ;
35
37
const CANCEL_NOTEBOOK_COMMAND_ID = 'notebook.cancelExecution' ;
@@ -818,16 +820,18 @@ registerAction2(class FixCellErrorction extends NotebookCellAction<ICellRange> {
818
820
}
819
821
820
822
const request : IInteractiveEditorRequest = {
821
- prompt : `Tweak the code to fix error: ${ err . message } , and keep original code ` ,
823
+ prompt : `/ fix ${ err . message } ` ,
822
824
selection : selection ,
823
825
wholeRange : textModel . getFullModelRange ( )
824
826
} ;
825
827
826
828
const reply = await provider . provideResponse ( session , request , _ctsSession . token ) ;
827
829
828
830
if ( reply && reply . type === 'editorEdit' ) {
829
- console . log ( reply ) ;
830
- textModel . applyEdits ( reply . edits ) ;
831
+ textModel . pushStackElement ( ) ;
832
+ const edits = reply . edits . map ( edit => EditOperation . replace ( Range . lift ( edit . range ) , edit . text ) ) ;
833
+ textModel . pushEditOperations ( null , edits , ( ) => null ) ;
834
+ textModel . pushStackElement ( ) ;
831
835
}
832
836
833
837
context . notebookEditor . hideProgress ( ) ;
0 commit comments