From 616e07a027426a5e2e97186e28ff22e81df44e0c Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 21 Sep 2025 06:17:38 +0200 Subject: [PATCH] fix(mappings): make sure function resolution is not ran in fast context functions call get_messages and those use vim.api functions. So move it at start of show_info block Signed-off-by: Tomas Slusny --- lua/CopilotChat/config/mappings.lua | 4 ++-- lua/CopilotChat/init.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/CopilotChat/config/mappings.lua b/lua/CopilotChat/config/mappings.lua index 74429e33..bcd9590e 100644 --- a/lua/CopilotChat/config/mappings.lua +++ b/lua/CopilotChat/config/mappings.lua @@ -337,10 +337,10 @@ return { local system_prompt = config.system_prompt async.run(function() - local infos = client:info() + local resolved_resources = copilot.resolve_functions(prompt, config) local selected_tools = copilot.resolve_tools(prompt, config) local selected_model = copilot.resolve_model(prompt, config) - local resolved_resources = copilot.resolve_functions(prompt, config) + local infos = client:info() selected_tools = vim.tbl_map(function(tool) return tool.name diff --git a/lua/CopilotChat/init.lua b/lua/CopilotChat/init.lua index 268405bd..35eec19f 100644 --- a/lua/CopilotChat/init.lua +++ b/lua/CopilotChat/init.lua @@ -515,7 +515,7 @@ end ---@param config CopilotChat.config.Shared? ---@return CopilotChat.config.prompts.Prompt, string function M.resolve_prompt(prompt, config) - if not prompt then + if prompt == nil then local message = M.chat:get_message(constants.ROLE.USER) if message then prompt = message.content