feat: support acp slash commands (#2775)

This commit is contained in:
yetone
2025-10-16 19:05:57 +08:00
committed by GitHub
parent 216ba4a8b2
commit 487972386e
8 changed files with 107 additions and 33 deletions

View File

@@ -56,9 +56,18 @@ function CommandsSource:execute(item, callback)
local commands = Utils.get_commands()
local command = vim.iter(commands):find(function(command) return command.name == item.data.name end)
if not command then return end
if not command then
callback()
return
end
local sidebar = require("avante").get()
if not command.callback then
if sidebar then sidebar:submit_input() end
callback()
return
end
command.callback(sidebar, nil, function()
local bufnr = sidebar.containers.input.bufnr ---@type integer
local content = table.concat(api.nvim_buf_get_lines(bufnr, 0, -1, false), "\n")