Skip to content

Commit 16aa924

Browse files
authored
fix(mappings): make sure function resolution is not ran in fast context (#1436)
functions call get_messages and those use vim.api functions. So move it at start of show_info block Signed-off-by: Tomas Slusny <[email protected]>
1 parent 181a523 commit 16aa924

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lua/CopilotChat/config/mappings.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,10 @@ return {
337337
local system_prompt = config.system_prompt
338338

339339
async.run(function()
340-
local infos = client:info()
340+
local resolved_resources = copilot.resolve_functions(prompt, config)
341341
local selected_tools = copilot.resolve_tools(prompt, config)
342342
local selected_model = copilot.resolve_model(prompt, config)
343-
local resolved_resources = copilot.resolve_functions(prompt, config)
343+
local infos = client:info()
344344

345345
selected_tools = vim.tbl_map(function(tool)
346346
return tool.name

lua/CopilotChat/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ end
515515
---@param config CopilotChat.config.Shared?
516516
---@return CopilotChat.config.prompts.Prompt, string
517517
function M.resolve_prompt(prompt, config)
518-
if not prompt then
518+
if prompt == nil then
519519
local message = M.chat:get_message(constants.ROLE.USER)
520520
if message then
521521
prompt = message.content

0 commit comments

Comments
 (0)