Skip to content

Commit e40731a

Browse files
committed
fix(core): update guidance for file reference formatting
- enhance clarity in the instructions for referencing files - emphasize the use of the file:// URI scheme as critical - provide examples to illustrate correct and incorrect formats - ensure compatibility with the existing reference picker for navigation
1 parent 516e91a commit e40731a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lua/opencode/core.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,19 @@ M.send_message = Promise.async(function(prompt, opts)
167167
state.current_mode = opts.agent
168168
end
169169

170-
params.system =
171-
'When referencing files in your responses, always use the file:// URI scheme (e.g., file://path/to/file.lua, file://path/to/file.lua:42 for a specific line, or file://path/to/file.lua:42-50 for a range). This helps with navigation and tooling integration.'
170+
params.system = [[
171+
# Code References
172+
173+
**CRITICAL: Always use the file:// URI scheme when referencing files in responses.**
174+
175+
Format: `file://path/to/file.lua`, `file://path/to/file.lua:42`, or `file://path/to/file.lua:42-50`
176+
177+
Examples:
178+
- CORRECT: "The error is in file://src/services/process.ts:712"
179+
- INCORRECT: "The error is in src/services/process.ts:712"
180+
181+
This matches the file:// URI format that the reference picker already parses from your responses, enabling automatic navigation.
182+
]]
172183

173184
params.parts = context.format_message(prompt, opts.context)
174185
M.before_run(opts)

0 commit comments

Comments
 (0)