Skip to content

Commit 0514e7d

Browse files
authored
refactor(instructions): simplify edit file block format (#1412)
Streamlined instructions for presenting file edits in code blocks. Reduced redundancy, clarified formatting, and emphasized minimal, precise changes. Multiple changes are now presented as separate code blocks for clarity.
1 parent 559e754 commit 0514e7d

1 file changed

Lines changed: 18 additions & 33 deletions

File tree

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,26 @@
11
return [[
22
<editFileInstructions>
3-
Use these instructions when editing files via code blocks. Your goal is to produce clear, minimal, and precise file edits.
3+
Use these instructions when editing files via code blocks. Present changes as clear, minimal, and precise file edits.
44
5-
Steps for presenting code changes:
6-
1. For each change, use the following markdown code block format with triple backticks:
7-
```<filetype> path=<file_name> start_line=<start_line> end_line=<end_line>
8-
<content>
9-
```
5+
For each change, use this markdown code block format:
6+
```<filetype> path=<file_name> start_line=<start_line> end_line=<end_line>
7+
<content>
8+
```
109
11-
2. Examples:
12-
```lua path={DIR}/lua/CopilotChat/init.lua start_line=40 end_line=50
13-
local function example()
14-
print("This is an example function.")
15-
end
16-
```
10+
Example:
11+
```lua path={DIR}/lua/CopilotChat/init.lua start_line=40 end_line=50
12+
local function example()
13+
print("This is an example function.")
14+
end
15+
```
1716
18-
```python path={DIR}/scripts/example.py start_line=10 end_line=15
19-
def example_function():
20-
print("This is an example function.")
21-
```
17+
Code content requirements:
18+
Always use absolute file paths in headers. Convert relative paths to absolute by prefixing with {DIR}.
19+
Keep changes minimal and focused. Include complete replacement code for the specified line range.
20+
Use proper indentation matching the source file. Include all necessary lines without eliding code.
21+
NEVER include line number prefixes in output code blocks - output only valid code as it should appear in the file.
22+
Address any diagnostics issues when fixing code.
2223
23-
```json path={DIR}/config/settings.json start_line=5 end_line=8
24-
{
25-
"setting": "value",
26-
"enabled": true
27-
}
28-
```
29-
30-
3. Requirements for code content:
31-
- Always use the absolute file path in the code block header. If the path is not already absolute, convert it to an absolute path prefixed by {DIR}.
32-
- Keep changes minimal and focused to produce short diffs
33-
- Include complete replacement code for the specified line range
34-
- Proper indentation matching the source
35-
- All necessary lines (no eliding with comments)
36-
- **Never include line number prefixes in your output code blocks. Only output valid code, exactly as it should appear in the file. Line numbers are only allowed in the code block header.**
37-
- Address any diagnostics issues when fixing code
38-
39-
4. If multiple changes are needed, present them as separate code blocks.
24+
Present multiple changes as separate code blocks.
4025
</editFileInstructions>
4126
]]

0 commit comments

Comments
 (0)