mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-25 00:44:52 +01:00
fix: confirm before deleting buffers/workspaces
This commit is contained in:
parent
b4b2e208f8
commit
a0c1fb3acd
1 changed files with 15 additions and 9 deletions
|
@ -76,22 +76,28 @@ M.delete = function(state, path, extra)
|
||||||
if selected.type == "root" and vim.startswith(selected.name, "#") then
|
if selected.type == "root" and vim.startswith(selected.name, "#") then
|
||||||
vim.ui.input({ prompt = "disconnect from workspace?" }, function (input)
|
vim.ui.input({ prompt = "disconnect from workspace?" }, function (input)
|
||||||
if input == nil then return end
|
if input == nil then return end
|
||||||
if input ~= "y" then return end
|
if not vim.startswith("y", string.lower(input)) then return end
|
||||||
ws_manager.leave()
|
ws_manager.leave()
|
||||||
manager.refresh("codemp")
|
manager.refresh("codemp")
|
||||||
end)
|
end)
|
||||||
elseif selected.type == "buffer" then
|
elseif selected.type == "buffer" then
|
||||||
if session.workspace == nil then error("join a workspace first") end
|
if session.workspace == nil then error("join a workspace first") end
|
||||||
|
vim.ui.input({ prompt = "delete buffer '" .. selected.name .. "'?" }, function (input)
|
||||||
|
if input == nil then return end
|
||||||
|
if not vim.startswith("y", string.lower(input)) then return end
|
||||||
session.workspace:delete_buffer(selected.name):await()
|
session.workspace:delete_buffer(selected.name):await()
|
||||||
print("deleted buffer " .. selected.name)
|
print("deleted buffer " .. selected.name)
|
||||||
manager.refresh("codemp")
|
manager.refresh("codemp")
|
||||||
|
end)
|
||||||
elseif selected.type == "workspace" then
|
elseif selected.type == "workspace" then
|
||||||
if session.client == nil then error("connect to server first") end
|
if session.client == nil then error("connect to server first") end
|
||||||
|
vim.ui.input({ prompt = "delete buffer '" .. selected.name .. "'?" }, function (input)
|
||||||
|
if input == nil then return end
|
||||||
|
if not vim.startswith("y", string.lower(input)) then return end
|
||||||
session.client:delete_workspace(selected.name):await()
|
session.client:delete_workspace(selected.name):await()
|
||||||
print("deleted workspace " .. selected.name)
|
print("deleted workspace " .. selected.name)
|
||||||
manager.refresh("codemp")
|
manager.refresh("codemp")
|
||||||
else
|
end)
|
||||||
print("/!\\ can only delete buffers and workspaces")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue