refactor(cmp): Extract get_chat_mentions for third-party cmp source usage (#2027)
This commit is contained in:
@@ -492,35 +492,7 @@ function M.setup(opts)
|
||||
if has_cmp then
|
||||
cmp.register_source("avante_commands", require("cmp_avante.commands"):new())
|
||||
|
||||
cmp.register_source(
|
||||
"avante_mentions",
|
||||
require("cmp_avante.mentions"):new(function()
|
||||
local mentions = Utils.get_mentions()
|
||||
|
||||
table.insert(mentions, {
|
||||
description = "file",
|
||||
command = "file",
|
||||
details = "add files...",
|
||||
callback = function(sidebar) sidebar.file_selector:open() end,
|
||||
})
|
||||
|
||||
table.insert(mentions, {
|
||||
description = "quickfix",
|
||||
command = "quickfix",
|
||||
details = "add files in quickfix list to chat context",
|
||||
callback = function(sidebar) sidebar.file_selector:add_quickfix_files() end,
|
||||
})
|
||||
|
||||
table.insert(mentions, {
|
||||
description = "buffers",
|
||||
command = "buffers",
|
||||
details = "add open buffers to the chat context",
|
||||
callback = function(sidebar) sidebar.file_selector:add_buffer_files() end,
|
||||
})
|
||||
|
||||
return mentions
|
||||
end)
|
||||
)
|
||||
cmp.register_source("avante_mentions", require("cmp_avante.mentions"):new(Utils.get_chat_mentions))
|
||||
|
||||
cmp.register_source("avante_prompt_mentions", require("cmp_avante.mentions"):new(Utils.get_mentions))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user