Skip to content

Commit 5b81998

Browse files
author
Zhe Yu
committed
refactor(nvim): move prompt library presets to dedicated module
1 parent 88717cc commit 5b81998

3 files changed

Lines changed: 20 additions & 10 deletions

File tree

docs/neovim/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,12 @@ The `query` tool contains the following extra config options:
284284
#### Prompt Library
285285

286286
On VectorCode 0.7.16+ and CodeCompanion.nvim 17.20.0+, VectorCode also provides a
287-
customisable prompt library that helps you RAG local directories. The following is the
288-
a preset that vectorises the lua source code and help files in the neovim runtime
289-
directory.
287+
customisable prompt library that helps you RAG local directories. The presets
288+
provided by VectorCode are available
289+
[here](../../lua/vectorcode/integrations/codecompanion/prompts/presets.lua), which
290+
you can refer to if you wish to build local RAG APPs with CodeCompanion.nvim and
291+
VectorCode.
292+
290293
```lua
291294
require('codecompanion').setup{
292295
extensions = {
@@ -297,6 +300,10 @@ require('codecompanion').setup{
297300
prompt_library = {
298301
{
299302
["Neovim Tutor"] = {
303+
-- this is for demonstration only.
304+
-- "Neovim Tutor" is shipped with this plugin
305+
-- and you don't need to add it in the config
306+
-- unless you're not happy with the defaults.
300307
project_root = vim.env.VIMRUNTIME,
301308
file_patterns = { "lua/**/*.lua", "doc/**/*.txt" },
302309
-- system_prompt = ...,

lua/codecompanion/_extensions/vectorcode/init.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
local vc_config = require("vectorcode.config")
2020
local logger = vc_config.logger
21-
local vim_runtime = vim.fs.normalize(vim.env.VIMRUNTIME)
2221

2322
---@type VectorCode.CodeCompanion.ExtensionOpts|{}
2423
local default_extension_opts = {
@@ -34,12 +33,7 @@ local default_extension_opts = {
3433
},
3534
tool_group = { enabled = true, collapse = true, extras = {} },
3635

37-
prompt_library = {
38-
["Neovim Tutor"] = {
39-
project_root = vim_runtime,
40-
file_patterns = { "lua/**/*.lua", "doc/**/*.txt" },
41-
},
42-
},
36+
prompt_library = require("vectorcode.integrations.codecompanion.prompts.presets"),
4337
}
4438

4539
---@type sub_cmd[]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---@type table<string, VectorCode.CodeCompanion.PromptFactory.Opts>
2+
local M = {}
3+
4+
M["Neovim Tutor"] = {
5+
project_root = vim.fs.normalize(vim.env.VIMRUNTIME),
6+
file_patterns = { "lua/**/*.lua", "doc/**/*.txt" },
7+
}
8+
9+
return M

0 commit comments

Comments
 (0)