refactor(git): share OpenOpts type between status_view open and toggle
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user