Skip to content

Commit b06fd11

Browse files
authored
feat(prompt): support custom Copilot instructions file (#1467)
Add support for including custom Copilot instructions from .github/copilot-instructions.md in the system prompt. Refactor prompt resolution logic into a new prompt.lua module, and update function and tool resolution to use this module. Also simplify diff hunk application fallback logic. Signed-off-by: Tomas Slusny <[email protected]>
1 parent 9843544 commit b06fd11

File tree

6 files changed

+435
-332
lines changed

6 files changed

+435
-332
lines changed

lua/CopilotChat/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
---@field blend number?
1515

1616
---@class CopilotChat.config.Shared
17-
---@field system_prompt nil|string|fun(source: CopilotChat.source):string
17+
---@field system_prompt nil|string
1818
---@field model string?
1919
---@field tools string|table<string>|nil
2020
---@field resources string|table<string>|nil

lua/CopilotChat/config/mappings.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,10 @@ return {
307307
end
308308

309309
local lines = {}
310-
local config, prompt = copilot.resolve_prompt(message.content)
311-
local system_prompt = config.system_prompt
312310

313311
async.run(function()
312+
local config, prompt = copilot.resolve_prompt(message.content)
313+
local system_prompt = config.system_prompt
314314
local resolved_resources = copilot.resolve_functions(prompt, config)
315315
local selected_tools = copilot.resolve_tools(prompt, config)
316316
local selected_model = copilot.resolve_model(prompt, config)

0 commit comments

Comments
 (0)