Skip to content

Commit 4c3d02f

Browse files
committed
feat(nvim): Add toggleable notifications for vectorising help files
1 parent 192b840 commit 4c3d02f

File tree

1 file changed

+16
-6
lines changed
  • lua/vectorcode/integrations/codecompanion/prompts

1 file changed

+16
-6
lines changed

lua/vectorcode/integrations/codecompanion/prompts/nvim.lua

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
---@module "codecompanion"
22

33
local config = require("vectorcode.config")
4+
5+
---@param rtp string path to the project_root
46
local prepare = function(rtp)
5-
vim.notify(
6-
"Vectorising neovim runtime files...",
7-
vim.log.levels.INFO,
8-
config.notify_opts
9-
)
7+
if config.get_user_config().notify then
8+
vim.notify(
9+
"Vectorising neovim runtime files...",
10+
vim.log.levels.INFO,
11+
config.notify_opts
12+
)
13+
end
1014
require("vectorcode.integrations.codecompanion.prompts").vectorise_files(
1115
{ vim.fs.joinpath(rtp, "lua/**/*.lua"), vim.fs.joinpath(rtp, "doc/**/*.txt") },
1216
rtp,
1317
function(result, _, _, _)
14-
if result ~= nil and not vim.tbl_isempty(result) then
18+
if
19+
result ~= nil
20+
and not vim.tbl_isempty(result)
21+
and config.get_user_config().notify
22+
then
1523
vim.schedule_wrap(vim.notify)(
1624
string.format("Added %d files to the database!", result.add or 0),
1725
vim.log.levels.INFO,
@@ -21,6 +29,7 @@ local prepare = function(rtp)
2129
end
2230
)
2331
end
32+
2433
return require("vectorcode.config").check_cli_wrap(function()
2534
local constants = require("codecompanion.config").config.constants
2635
local rtp = vim.fs.normalize(vim.env.VIMRUNTIME)
@@ -61,6 +70,7 @@ You can ONLY use the vectorcode tools to interact with these files or directory.
6170
DO NOT attempt to read from or write into this directory.
6271
When the user asked a question that is not part of a previous query tool call, make a new query using new keywords that are directly relevant to the new question.
6372
If the tool returns an error that says the collection doesn't exist, it's because the files are still being indexed, and you should ask the user to wait for it to finish.
73+
Do not cite information that was not part of the provided context or tool output.
6474
]],
6575
rtp
6676
),

0 commit comments

Comments
 (0)