Skip to content

Commit cb1c85a

Browse files
committed
Format failed patches as code blocks for intelligent update
1 parent 009d088 commit cb1c85a

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

packages/vscode/src/commands/apply-chat-response-command/apply-chat-response-command.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,25 +392,26 @@ export function apply_chat_response_command(context: vscode.ExtensionContext) {
392392
endpoint_url = provider.base_url
393393
}
394394

395-
// Convert failed patches to clipboard format for intelligent update
396-
const failed_patches_text = failed_patches
397-
.map((patch) => `// ${patch.file_path}\n${patch.content}`)
398-
.join('\n\n')
395+
const failed_patches_as_code_blocks = failed_patches
396+
.map(
397+
(patch) =>
398+
`\`\`\`\n// ${patch.file_path}\n${patch.content}\n\`\`\``
399+
)
400+
.join('\n')
399401

400402
try {
401403
const intelligent_update_states = await handle_intelligent_update(
402404
{
403405
endpoint_url,
404406
api_key: provider.api_key,
405407
model: file_refactoring_config.model,
406-
clipboard_text: failed_patches_text,
408+
clipboard_text: failed_patches_as_code_blocks,
407409
context: context,
408410
is_single_root_folder_workspace
409411
}
410412
)
411413

412414
if (intelligent_update_states) {
413-
// Combine original states from successful patches and intelligent update
414415
const combined_states = [
415416
...all_original_states,
416417
...intelligent_update_states

0 commit comments

Comments
 (0)