The error I am seeing:
[CopilotChat] [ERROR] invalid capture index
[CopilotChat] stack traceback:
[CopilotChat] ...hare/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:162: in function <...hare/nvim/lazy/CopilotChat.nvim/lu
a/CopilotChat/init.lua:159>
[CopilotChat] [C]: in function 'gsub'
[CopilotChat] ...e/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/prompts.lua:340: in function 'resolve_prompt'
[CopilotChat] ...hare/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:426: in function <...hare/nvim/lazy/CopilotChat.nvim/lu
a/CopilotChat/init.lua:425>
[CopilotChat] [C]: in function 'xpcall'
[CopilotChat] ...hare/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:166: in function <...hare/nvim/lazy/CopilotChat.nvim/lu
a/CopilotChat/init.lua:158>
The directory name has a %20 in it, and i believe lua is trying to substitute a capture in because of that.
I think this is being caused by what is now this line: prompts.lua
config.system_prompt = config.system_prompt:gsub('{DIR}', source.cwd())
I think treating the result as a raw result of a function would protect against this:
config.system_prompt = config.system_prompt:gsub('{DIR}', function() return source.cwd() end)
The error I am seeing:
The directory name has a
%20in it, and i believe lua is trying to substitute a capture in because of that.I think this is being caused by what is now this line: prompts.lua
I think treating the result as a raw result of a function would protect against this: