Skip to content

Commit da6b51a

Browse files
author
Zhe Yu
committed
feat(nvim): Improve vectorisation feedback
1 parent a5b5cef commit da6b51a

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

docs/neovim/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ require('codecompanion').setup{
306306
}
307307
```
308308

309+
The first time will take some extra time for computing the embeddings, but the
310+
subsequent runs should be a lot faster.
311+
309312
### [CopilotC-Nvim/CopilotChat.nvim](https://github.com/CopilotC-Nvim/CopilotChat.nvim)
310313

311314
[CopilotC-Nvim/CopilotChat.nvim](https://github.com/CopilotC-Nvim/CopilotChat.nvim)

lua/vectorcode/integrations/codecompanion/prompts/init.lua

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local M = {}
22

33
local vc_config = require("vectorcode.config")
4+
local cc_common = require("vectorcode.integrations.codecompanion.common")
45
local utils = require("vectorcode.utils")
56
local constants = require("codecompanion.config").config.constants
67

@@ -88,6 +89,9 @@ Here's my question:
8889
opts = {
8990
ignore_system_prompt = opts.system_prompt ~= nil,
9091
pre_hook = function()
92+
vim.notify(
93+
string.format("Add files under `%s` to the database.", opts.project_root)
94+
)
9195
M.vectorise_files(
9296
vim.iter(opts.file_patterns):map(function(p)
9397
if vim.fn.isabsolutepath(p) == 1 then
@@ -97,19 +101,24 @@ Here's my question:
97101
end
98102
end),
99103
opts.project_root,
100-
function(result, _, _, _)
101-
if
102-
result ~= nil
103-
and not vim.tbl_isempty(result)
104-
and vc_config.get_user_config().notify
105-
then
104+
function(result, err, _, _)
105+
if result ~= nil and not vim.tbl_isempty(result) then
106106
vim.schedule_wrap(vim.notify)(
107107
string.format(
108108
"Vectorised %d files at `%s`.",
109109
result.add or 0,
110110
opts.project_root
111111
)
112112
)
113+
elseif err ~= nil then
114+
err = cc_common.flatten_table_to_string(err)
115+
if err ~= "" then
116+
vim.schedule_wrap(vim.notify)(
117+
err,
118+
vim.log.levels.WARN,
119+
vc_config.notify_opts
120+
)
121+
end
113122
end
114123
end
115124
)

0 commit comments

Comments
 (0)