feat: extract text editor tools (#1726)

This commit is contained in:
yetone
2025-03-26 17:59:59 +08:00
committed by GitHub
parent 0e69891bdc
commit b41556ee21
8 changed files with 259 additions and 99 deletions

View File

@@ -72,4 +72,17 @@ function M.already_in_context(path)
return false
end
---@param abs_path string
---@return integer bufnr
---@return string | nil error
function M.get_bufnr(abs_path)
local sidebar = require("avante").get()
if not sidebar then return 0, "Avante sidebar not found" end
local current_winid = vim.api.nvim_get_current_win()
vim.api.nvim_set_current_win(sidebar.code.winid)
local bufnr = Utils.get_or_create_buffer_with_filepath(abs_path)
vim.api.nvim_set_current_win(current_winid)
return bufnr, nil
end
return M