Skip to content

Commit 8769d22

Browse files
authored
fix(chat): insert stickies passed to open() (#1476)
Ensure that `stickies` that are passed as arguments to `open()` are merged with the static config and persisted in the chat window Fixes #1475
1 parent db56110 commit 8769d22

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lua/CopilotChat/init.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,18 @@ function M.open(config)
242242
local message = M.chat:get_message(constants.ROLE.USER)
243243
if message then
244244
local clean_prompt = process_sticky(message.content, config)
245+
local stickies = M.chat:get_sticky()
246+
local content = ''
247+
if not vim.tbl_isempty(stickies) then
248+
content = '\n> ' .. table.concat(stickies, '\n> ') .. '\n\n'
249+
end
245250
if clean_prompt and clean_prompt ~= '' then
251+
content = content .. clean_prompt
252+
end
253+
if content ~= '' then
246254
M.chat:add_message({
247255
role = constants.ROLE.USER,
248-
content = '\n> ' .. table.concat(M.chat:get_sticky(), '\n> ') .. '\n\n' .. clean_prompt,
256+
content = content,
249257
}, true)
250258
end
251259
end

0 commit comments

Comments
 (0)