diff --git a/lua/codecompanion/_extensions/vectorcode/init.lua b/lua/codecompanion/_extensions/vectorcode/init.lua index 68c19236..a7eda209 100644 --- a/lua/codecompanion/_extensions/vectorcode/init.lua +++ b/lua/codecompanion/_extensions/vectorcode/init.lua @@ -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 = {} }, } diff --git a/lua/vectorcode/integrations/codecompanion/common.lua b/lua/vectorcode/integrations/codecompanion/common.lua index 7692d574..4bcc7f1b 100644 --- a/lua/vectorcode/integrations/codecompanion/common.lua +++ b/lua/vectorcode/integrations/codecompanion/common.lua @@ -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", diff --git a/lua/vectorcode/integrations/codecompanion/vectorise_tool.lua b/lua/vectorcode/integrations/codecompanion/vectorise_tool.lua index 0bea4d8b..29f64e3f 100644 --- a/lua/vectorcode/integrations/codecompanion/vectorise_tool.lua +++ b/lua/vectorcode/integrations/codecompanion/vectorise_tool.lua @@ -67,6 +67,9 @@ return function(opts) } end end + if project_root ~= "" then + action.project_root = project_root + end vim.list_extend( args, vim @@ -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, @@ -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, }, } diff --git a/src/vectorcode/lsp_main.py b/src/vectorcode/lsp_main.py index e26bd7b8..f9b883f9 100644 --- a/src/vectorcode/lsp_main.py +++ b/src/vectorcode/lsp_main.py @@ -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] = []