Go back to older prompt

This commit is contained in:
Matt Rubens
2024-12-17 01:15:15 -05:00
parent 7d6e04fbe8
commit 792780e78d

View File

@@ -75,8 +75,8 @@ If you're not confident in the exact content to search for, use the read_file to
Parameters: Parameters:
- path: (required) The path of the file to modify (relative to the current working directory ${cwd}) - 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. - diff: (required) The search/replace block defining the changes.
- start_line: (required) The line number where the search block starts (inclusive). - start_line: (required) The line number where the search block starts.
- end_line: (required) The line number where the search block ends (inclusive). - end_line: (required) The line number where the search block ends.
Diff format: Diff format:
\`\`\` \`\`\`
@@ -98,79 +98,30 @@ Original file:
5 | return total 5 | return total
\`\`\` \`\`\`
1. Search/replace a specific chunk of code: Search/Replace content:
\`\`\` \`\`\`
<apply_diff>
<path>File path here</path>
<diff>
<<<<<<< SEARCH <<<<<<< SEARCH
def calculate_total(items):
total = 0 total = 0
for item in items: for item in items:
total += item total += item
return total return total
======= =======
def calculate_total(items):
"""Calculate total with 10% markup""" """Calculate total with 10% markup"""
return sum(item * 1.1 for item in items) return sum(item * 1.1 for item in items)
>>>>>>> REPLACE >>>>>>> REPLACE
</diff>
<start_line>2</start_line>
<end_line>5</end_line>
</apply_diff>
\`\`\` \`\`\`
Result: Usage:
\`\`\`
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):
\`\`\`
<apply_diff> <apply_diff>
<path>File path here</path> <path>File path here</path>
<diff> <diff>
<<<<<<< SEARCH Your search/replace content here
=======
"""TODO: Write a test for this"""
>>>>>>> REPLACE
</diff> </diff>
<start_line>2</start_line> <start_line>1</start_line>
<end_line>2</end_line>
</apply_diff>
\`\`\`
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:
\`\`\`
<apply_diff>
<path>File path here</path>
<diff>
<<<<<<< SEARCH
total = 0
for item in items:
total += item
return total
=======
>>>>>>> REPLACE
</diff>
<start_line>2</start_line>
<end_line>5</end_line> <end_line>5</end_line>
</apply_diff> </apply_diff>`
\`\`\`
Result:
\`\`\`
1 | def calculate_total(items):
\`\`\`
`
} }
applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): DiffResult { applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): DiffResult {