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
8 changes: 7 additions & 1 deletion lua/codecompanion/_extensions/vectorcode/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
local vc_config = require("vectorcode.config")
local logger = vc_config.logger

local use_lsp = vc_config.get_user_config().async_backend == "lsp"

---@type VectorCode.CodeCompanion.ExtensionOpts|{}
local default_extension_opts = {
tool_opts = { ls = {}, query = {}, vectorise = { requires_approval = true } },
tool_opts = {
ls = { use_lsp = use_lsp, requires_approval = false },
query = { use_lsp = use_lsp, requires_approval = false },
vectorise = { use_lsp = use_lsp, requires_approval = true },
},
tool_group = { enabled = true, collapse = true, extras = {} },
}

Expand Down
6 changes: 2 additions & 4 deletions lua/vectorcode/integrations/codecompanion/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ local logger = vc_config.logger
local default_query_options = {
max_num = { chunk = -1, document = -1 },
default_num = { chunk = 50, document = 10 },
use_lsp = false,
ls_on_start = false,
no_duplicate = true,
chunk_mode = false,
}

---@type VectorCode.CodeCompanion.LsToolOpts
local default_ls_options = { use_lsp = false }
local default_ls_options = {}

---@type VectorCode.CodeCompanion.VectoriseToolOpts
local default_vectorise_options = { use_lsp = false }
local default_vectorise_options = {}

return {
tool_result_source = "VectorCodeToolResult",
Expand Down
13 changes: 12 additions & 1 deletion lua/vectorcode/integrations/codecompanion/vectorise_tool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ return function(opts)
}
end
end
if project_root ~= "" then
action.project_root = project_root
end
vim.list_extend(
args,
vim
Expand Down Expand Up @@ -105,8 +108,9 @@ return function(opts)
end,
---@param self CodeCompanion.Agent.Tool
---@param agent CodeCompanion.Agent
---@param cmd VectoriseToolArgs
---@param stdout VectorCode.VectoriseResult[]
success = function(self, agent, _, stdout)
success = function(self, agent, cmd, stdout)
stdout = stdout[1]
agent.chat:add_tool_output(
self,
Expand All @@ -125,6 +129,13 @@ return function(opts)
stdout.failed
)
)
if cmd.project_root and cmd.project_root then
agent.chat:add_tool_output(
self,
string.format("\nThe files were added to `%s`", cmd.project_root),
""
)
end
end,
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/vectorcode/lsp_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ async def execute_command(ls: LanguageServer, args: list[str]):
progress_token,
types.WorkDoneProgressBegin(
"VectorCode",
message="Looking for other projects indexed by VectorCode",
message="Looking for available projects indexed by VectorCode",
),
)
projects: list[dict] = []
Expand Down