File tree Expand file tree Collapse file tree 2 files changed +36
-14
lines changed Expand file tree Collapse file tree 2 files changed +36
-14
lines changed Original file line number Diff line number Diff line change 1
1
import { resolveRelativePathInDir } from "core/util/ideUtils" ;
2
2
import { v4 as uuid } from "uuid" ;
3
+ import { handleEditToolApplyError } from "../../redux/thunks/handleApplyStateUpdate" ;
3
4
import { ClientToolImpl } from "./callClientTool" ;
4
5
5
6
interface EditOperation {
@@ -117,13 +118,23 @@ export const multiEditImpl: ClientToolImpl = async (
117
118
}
118
119
119
120
// Apply the changes to the file
120
- await extras . ideMessenger . request ( "applyToFile" , {
121
- streamId,
122
- toolCallId,
123
- text : newContent ,
124
- filepath : targetFilepath ,
125
- isSearchAndReplace : true ,
126
- } ) ;
121
+ void extras . ideMessenger
122
+ . request ( "applyToFile" , {
123
+ streamId,
124
+ toolCallId,
125
+ text : newContent ,
126
+ filepath : targetFilepath ,
127
+ isSearchAndReplace : true ,
128
+ } )
129
+ . then ( ( res ) => {
130
+ if ( res . status === "error" ) {
131
+ void extras . dispatch (
132
+ handleEditToolApplyError ( {
133
+ toolCallId,
134
+ } ) ,
135
+ ) ;
136
+ }
137
+ } ) ;
127
138
128
139
// Return success - applyToFile will handle the completion state
129
140
return {
Original file line number Diff line number Diff line change 1
1
import { resolveRelativePathInDir } from "core/util/ideUtils" ;
2
2
import { v4 as uuid } from "uuid" ;
3
+ import { handleEditToolApplyError } from "../../redux/thunks/handleApplyStateUpdate" ;
3
4
import { ClientToolImpl } from "./callClientTool" ;
4
5
5
6
export const singleFindAndReplaceImpl : ClientToolImpl = async (
@@ -61,13 +62,23 @@ export const singleFindAndReplaceImpl: ClientToolImpl = async (
61
62
}
62
63
63
64
// Apply the changes to the file
64
- await extras . ideMessenger . request ( "applyToFile" , {
65
- streamId,
66
- toolCallId,
67
- text : newContent ,
68
- filepath : resolvedFilepath ,
69
- isSearchAndReplace : true ,
70
- } ) ;
65
+ void extras . ideMessenger
66
+ . request ( "applyToFile" , {
67
+ streamId,
68
+ toolCallId,
69
+ text : newContent ,
70
+ filepath : resolvedFilepath ,
71
+ isSearchAndReplace : true ,
72
+ } )
73
+ . then ( ( res ) => {
74
+ if ( res . status === "error" ) {
75
+ void extras . dispatch (
76
+ handleEditToolApplyError ( {
77
+ toolCallId,
78
+ } ) ,
79
+ ) ;
80
+ }
81
+ } ) ;
71
82
72
83
// Return success - applyToFile will handle the completion state
73
84
return {
You can’t perform that action at this time.
0 commit comments