Repository navigation
Commit 30f6f89
committed
Refactor file operations to support pure renames and consolidate shared helpers for applying response changes
- Fix binary file corruption during pure file moves by adding an is_pure_rename flag that bypasses UTF-8 string reading/writing and safely transfers the file using raw filesystem copy operations. Also take care about re-applying from response history. [Accuracy boost]
- it's been reported that from response history, pure renames don't work. They only work for the very first-time application (the UI reports correctly but no changes on filesystem take place). propose a solution that fully relies on FileInPreview [Accuracy boost]
├── apps
│ └── editor
│ ├── package.json
│ └── src
│ ├── commands
│ │ └── apply-response-command
│ │ ├── apply-response-command.ts
│ │ ├── index.ts
│ │ ├── response-processor
│ │ │ ├── handlers
│ │ │ │ ├── diff-handler.ts
│ │ │ │ ├── fast-replace-handler.ts
│ │ │ │ ├── patch-repair-handler.ts
│ │ │ │ ├── restore-preview-handler.ts
│ │ │ │ ├── search-replace-handler.ts
│ │ │ │ └── truncated-handler.ts
│ │ │ ├── index.ts
│ │ │ └── response-processor.ts
│ │ ├── types
│ │ │ └── original-file-state.ts
│ │ └── utils
│ │ ├── file-checks.ts
│ │ ├── file-operations
│ │ │ ├── apply-file-content.ts
│ │ │ ├── apply-file-relocations.ts
│ │ │ ├── cleanup-rename-source.ts
│ │ │ ├── close-file-tabs.ts
│ │ │ ├── create-file-if-needed.ts
│ │ │ ├── ensure-directory.ts
│ │ │ ├── get-rename-source-info.ts
│ │ │ ├── handle-deleted-file-item.ts
│ │ │ ├── index.ts
│ │ │ ├── prepare-rename-operation.ts
│ │ │ ├── preserve-newline.ts
│ │ │ ├── read-rename-source-file.ts
│ │ │ ├── relocate-file.ts
│ │ │ ├── remove-directory-if-empty.ts
│ │ │ ├── undo-files.ts
│ │ │ └── uri-exists.ts
│ │ ├── preview
│ │ │ ├── build-history-files.ts
│ │ │ ├── file-preparer.ts
│ │ │ ├── preview.ts
│ │ │ ├── types.ts
│ │ │ └── workspace-listener.ts
│ │ ├── preview-handler.ts
│ │ ├── response-parser
│ │ │ ├── index.ts
│ │ │ ├── parsers
│ │ │ │ ├── diff-parser
│ │ │ │ │ ├── diff-parser.ts
│ │ │ │ │ └── index.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── standard-parser
│ │ │ │ ├── helpers
│ │ │ │ │ ├── create-or-update-file-item.ts
│ │ │ │ │ └── extract-and-set-workspace-path.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── standard-parser.ts
│ │ │ └── response-parser.ts
│ │ ├── state-manager.ts
│ │ ├── tab-group-manager.ts
│ │ └── workspace.ts
│ ├── context
│ │ └── context-initialization.ts
│ ├── extension.ts
│ ├── utils
│ │ └── path-sanitizer.ts
│ └── views
│ └── prompt
│ ├── backend
│ │ ├── message-handlers
│ │ │ ├── handle-apply-response-from-history.ts
│ │ │ └── index.ts
│ │ └── prompt-view-provider.ts
│ ├── frontend
│ │ ├── Main
│ │ │ ├── Main.tsx
│ │ │ └── MainView
│ │ │ └── MainView.tsx
│ │ ├── Prompt.tsx
│ │ └── hooks
│ │ └── use-response-history.ts
│ └── types
│ └── messages.ts
└── packages
├── shared
│ └── src
│ └── types
│ ├── file-in-preview.ts
│ └── response-history-item.ts
└── ui
└── src
└── components
└── editor
└── prompt-view
├── ResponsePreview
│ ├── ResponsePreview.tsx
│ └── components
│ └── FileItem
│ └── FileItem.tsx
└── Responses
├── Responses.module.scss
├── Responses.tsx
└── index.ts1 parent 876c3b9 commit 30f6f89
16 files changed
Lines changed: 358 additions & 256 deletions
File tree
- apps/editor/src/commands/apply-response-command
- response-processor/handlers
- types
- utils
- file-operations
- preview
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
| 157 | + | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| |||
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 177 | + | |
179 | 178 | | |
180 | 179 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
189 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
190 | 200 | | |
191 | 201 | | |
192 | 202 | | |
| |||
364 | 374 | | |
365 | 375 | | |
366 | 376 | | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
| 377 | + | |
371 | 378 | | |
372 | 379 | | |
373 | 380 | | |
| |||
552 | 559 | | |
553 | 560 | | |
554 | 561 | | |
555 | | - | |
| 562 | + | |
| 563 | + | |
556 | 564 | | |
557 | 565 | | |
558 | 566 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | | - | |
16 | 14 | | |
17 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 137 | + | |
139 | 138 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
148 | 144 | | |
149 | 145 | | |
150 | | - | |
151 | | - | |
152 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
153 | 151 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | 152 | | |
159 | 153 | | |
160 | 154 | | |
161 | | - | |
| 155 | + | |
162 | 156 | | |
163 | 157 | | |
164 | 158 | | |
165 | 159 | | |
166 | | - | |
| 160 | + | |
| 161 | + | |
167 | 162 | | |
168 | | - | |
169 | 163 | | |
170 | 164 | | |
171 | 165 | | |
| |||
189 | 183 | | |
190 | 184 | | |
191 | 185 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 186 | + | |
| 187 | + | |
200 | 188 | | |
201 | 189 | | |
202 | 190 | | |
203 | | - | |
| 191 | + | |
204 | 192 | | |
205 | 193 | | |
206 | 194 | | |
207 | 195 | | |
208 | 196 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 197 | + | |
219 | 198 | | |
220 | | - | |
221 | 199 | | |
222 | 200 | | |
223 | 201 | | |
| |||
232 | 210 | | |
233 | 211 | | |
234 | 212 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
257 | 228 | | |
258 | | - | |
259 | | - | |
| 229 | + | |
| 230 | + | |
260 | 231 | | |
261 | 232 | | |
262 | 233 | | |
| |||
0 commit comments