Skip to content

feat: add option to disable contexts in prompts #1101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lua/CopilotChat/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ local select = require('CopilotChat.select')
---@field stream nil|fun(chunk: string, source: CopilotChat.source):string
---@field callback nil|fun(response: string, source: CopilotChat.source):string
---@field remember_as_sticky boolean?
---@field include_contexts_in_prompt boolean?
---@field selection false|nil|fun(source: CopilotChat.source):CopilotChat.select.selection?
---@field window CopilotChat.config.window?
---@field show_help boolean?
Expand Down Expand Up @@ -71,6 +72,8 @@ return {
callback = nil, -- Function called when full response is received (retuned string is stored to history)
remember_as_sticky = true, -- Remember model/agent/context as sticky prompts when asking questions

include_contexts_in_prompt = true, -- Include contexts in prompt

-- default selection
selection = function(source)
return select.visual(source) or select.buffer(source)
Expand Down
8 changes: 5 additions & 3 deletions lua/CopilotChat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,11 @@ function M.ask(prompt, config)

-- Resolve context name and description
local contexts = {}
for name, context in pairs(M.config.contexts) do
if context.description then
contexts[name] = context.description
if config.include_contexts_in_prompt then
for name, context in pairs(M.config.contexts) do
if context.description then
contexts[name] = context.description
end
end
end

Expand Down
Loading