feat(context): mention @quickfix to add files in qf to context (#988)

Neovim allows quickfix list to be populated in a variety of ways: grep,
lsp symbol references etc. Being able to add files in the quickfix
window to the LLM chat context allows for interesting workflows. For
example, one could search for a symbol using the LSP integration,
populate the quickfix with that list and then pass those along as
context in Avante using @quickfix mention in the sidebar.

If there are no files in the quickfix list or the items do not have a
file, nothing is added to the context.
This commit is contained in:
Rohith Ravi
2024-12-24 06:48:37 -08:00
committed by GitHub
parent 429bdd6b61
commit be92be6124
2 changed files with 19 additions and 0 deletions

View File

@@ -1803,6 +1803,13 @@ function Sidebar:create_input_container(opts)
callback = function() self.file_selector:open() end,
})
table.insert(mentions, {
description = "quickfix",
command = "quickfix",
details = "add files in quickfix list to chat context",
callback = function() self.file_selector:add_quickfix_files() end,
})
cmp.register_source(
"avante_commands",
require("cmp_avante.commands"):new(self:get_commands(), self.input_container.bufnr)