Skip to content

Commit 6c2ed2b

Browse files
committed
fix(api): show selection/line context in Quick Chat input prompt
Adds the currently selected range or line number to the Quick Chat input UI prompt, improving user clarity on the chat scope.
1 parent 6f678e9 commit 6c2ed2b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/opencode/api.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ function M.quick_chat(message, range)
126126
end
127127

128128
if not message or #message == 0 then
129-
vim.ui.input({ prompt = 'Quick Chat Message: ', win = { relative = 'cursor' } }, function(input)
129+
local scope = range and ('[selection: ' .. range.start .. '-' .. range.stop .. ']')
130+
or '[line: ' .. tostring(vim.api.nvim_win_get_cursor(0)[1]) .. ']'
131+
vim.ui.input({ prompt = 'Quick Chat Message: ' .. scope, win = { relative = 'cursor' } }, function(input)
130132
if input and input ~= '' then
131133
local prompt, ctx = util.parse_quick_context_args(input)
132134
quick_chat.quick_chat(prompt, { context_config = ctx }, range)

0 commit comments

Comments
 (0)