diff --git a/src/core/diff/strategies/search-replace.ts b/src/core/diff/strategies/search-replace.ts index d7bc30f..5409e1a 100644 --- a/src/core/diff/strategies/search-replace.ts +++ b/src/core/diff/strategies/search-replace.ts @@ -75,8 +75,8 @@ If you're not confident in the exact content to search for, use the read_file to Parameters: - path: (required) The path of the file to modify (relative to the current working directory ${cwd}) - diff: (required) The search/replace block defining the changes. -- start_line: (required) The line number where the search block starts (inclusive). -- end_line: (required) The line number where the search block ends (inclusive). +- start_line: (required) The line number where the search block starts. +- end_line: (required) The line number where the search block ends. Diff format: \`\`\` @@ -98,79 +98,30 @@ Original file: 5 | return total \`\`\` -1. Search/replace a specific chunk of code: +Search/Replace content: \`\`\` - -File path here - <<<<<<< SEARCH +def calculate_total(items): total = 0 for item in items: total += item return total ======= +def calculate_total(items): """Calculate total with 10% markup""" return sum(item * 1.1 for item in items) >>>>>>> REPLACE - -2 -5 - \`\`\` -Result: -\`\`\` -1 | def calculate_total(items): -2 | """Calculate total with 10% markup""" -3 | return sum(item * 1.1 for item in items) -\`\`\` - -2. Insert code at a specific line (start_line and end_line must be the same, and the content gets inserted before whatever is currently at that line): -\`\`\` +Usage: File path here -<<<<<<< SEARCH -======= - """TODO: Write a test for this""" ->>>>>>> REPLACE +Your search/replace content here -2 -2 - -\`\`\` - -Result: -\`\`\` -1 | def calculate_total(items): -2 | """TODO: Write a test for this""" -3 | """Calculate total with 10% markup""" -4 | return sum(item * 1.1 for item in items) -\`\`\` - -3. Delete code at a specific line range: -\`\`\` - -File path here - -<<<<<<< SEARCH - total = 0 - for item in items: - total += item - return total -======= ->>>>>>> REPLACE - -2 +1 5 - -\`\`\` - -Result: -\`\`\` -1 | def calculate_total(items): -\`\`\` -` +` } applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): DiffResult {