Skip to content

Commit 9cb1ed1

Browse files
author
Zhe Yu
committed
feat(nvim): Allow adding custom tools to the vectorcode tool group
1 parent dbc8c84 commit 9cb1ed1

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

lua/codecompanion/_extensions/vectorcode/init.lua

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local logger = vc_config.logger
1515
---@type VectorCode.CodeCompanion.ExtensionOpts|{}
1616
local default_extension_opts = {
1717
tool_opts = { ls = {}, query = {}, vectorise = {} },
18-
tool_group = { enabled = true, collapse = true },
18+
tool_group = { enabled = true, collapse = true, extras = {} },
1919
}
2020

2121
---@type sub_cmd[]
@@ -56,15 +56,25 @@ local M = {
5656
end
5757

5858
if opts.tool_group.enabled then
59+
local included_tools = vim
60+
.iter(valid_tools)
61+
:map(function(s)
62+
return "vectorcode_" .. s
63+
end)
64+
:totable()
65+
if opts.tool_group.extras and not vim.tbl_isempty(opts.tool_group.extras) then
66+
vim.list_extend(included_tools, opts.tool_group.extras)
67+
end
68+
logger.info(
69+
string.format(
70+
"Loading the following tools into `vectorcode_toolbox` tool group:\n%s",
71+
vim.inspect(included_tools)
72+
)
73+
)
5974
cc_config.strategies.chat.tools.groups["vectorcode_toolbox"] = {
6075
opts = { collapse_tools = opts.tool_group.collapse },
6176
description = "Use VectorCode to automatically build and retrieve repository-level context.",
62-
tools = vim
63-
.iter(valid_tools)
64-
:map(function(s)
65-
return "vectorcode_" .. s
66-
end)
67-
:totable(),
77+
tools = included_tools,
6878
}
6979
end
7080
end),

lua/vectorcode/types.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,5 @@
101101
---@field enabled boolean
102102
--- Whether to show the individual tools in the references
103103
---@field collapse boolean
104+
--- Other tools that you'd like to include in `vectorcode_toolbox`
105+
---@field extras string[]

0 commit comments

Comments
 (0)