refactor(git): share OpenOpts type between status_view open and toggle

This commit is contained in:
2026-05-19 14:50:10 +02:00
parent 26d074c464
commit 8121227ba4
+7 -3
View File
@@ -662,7 +662,10 @@ local function set_keymaps(bufnr, placement)
end
end
---@param opts? { placement: ow.Git.StatusView.Placement? }
---@class ow.Git.StatusView.OpenOpts
---@field placement ow.Git.StatusView.Placement?
---@param opts? ow.Git.StatusView.OpenOpts
function M.open(opts)
opts = opts or {}
local placement = opts.placement or "sidebar"
@@ -765,13 +768,14 @@ function M.read_uri(buf)
r:refresh()
end
function M.toggle()
---@param opts? ow.Git.StatusView.OpenOpts
function M.toggle(opts)
local existing = find_view()
if existing then
vim.api.nvim_win_close(existing, false)
return
end
M.open({ placement = "sidebar" })
M.open(opts)
end
return M