Skip to content
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
2 changes: 2 additions & 0 deletions lua/CopilotChat/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
---@field auto_fold boolean?
---@field insert_at_end boolean?
---@field clear_chat_on_new_prompt boolean?
---@field stop_on_tool_failure boolean?

--- CopilotChat default configuration
---@class CopilotChat.config.Config : CopilotChat.config.Shared
Expand Down Expand Up @@ -94,6 +95,7 @@ return {
auto_insert_mode = false, -- Automatically enter insert mode when opening window and on new prompt
insert_at_end = false, -- Move cursor to end of buffer when inserting text
clear_chat_on_new_prompt = false, -- Clears chat on every new prompt
stop_on_tool_failure = false, -- Stop processing prompt if any tool fails (preserves quota)

-- Static config starts here (can be configured only via setup function)

Expand Down
8 changes: 7 additions & 1 deletion lua/CopilotChat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,13 @@ function M.resolve_functions(prompt, config)

local schema = tools[name] and tools[name].schema or nil
local result = ''
local ok, output = pcall(tool.resolve, functions.parse_input(input, schema), state.source)
local ok, output
if config.stop_on_tool_failure then
output = tool.resolve(functions.parse_input(input, schema), state.source)
ok = true
else
ok, output = pcall(tool.resolve, functions.parse_input(input, schema), state.source)
end
if not ok then
result = string.format(BLOCK_OUTPUT_FORMAT, 'error', utils.make_string(output))
else
Expand Down
Loading