feat: extract text editor tools (#1726)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user