mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-21 23:14:54 +01:00
fix: always leave workspace before disconnecting
This commit is contained in:
parent
e0c1069939
commit
594330c721
3 changed files with 9 additions and 0 deletions
|
@ -80,6 +80,10 @@ local connected_actions = {
|
|||
end,
|
||||
|
||||
disconnect = function()
|
||||
if CODEMP.workspace ~= nil then
|
||||
print(" xx leaving workspace " .. CODEMP.workspace.name)
|
||||
workspace.leave()
|
||||
end
|
||||
print(" xx disconnecting client " .. CODEMP.client.id)
|
||||
CODEMP.client = nil -- should drop and thus close everything
|
||||
collectgarbage("collect") -- make sure we drop
|
||||
|
|
|
@ -37,6 +37,10 @@ if CODEMP == nil then
|
|||
{"ExitPre"},
|
||||
{
|
||||
callback = function (_ev)
|
||||
if CODEMP.workspace ~= nil then
|
||||
print(" xx leaving workspace " .. CODEMP.workspace.name)
|
||||
require('codemp.workspace').leave()
|
||||
end
|
||||
if CODEMP.client ~= nil then
|
||||
print(" xx disconnecting codemp client")
|
||||
CODEMP.client = nil -- drop reference so it gets garbage collected
|
||||
|
|
|
@ -116,6 +116,7 @@ M.delete = function(state, path, extra)
|
|||
if selected.type == "title" then
|
||||
vim.ui.input({ prompt = "disconnect from server?" }, function(choice)
|
||||
if not choice or not vim.startswith(string.lower(choice), "y") then return end
|
||||
if CODEMP.workspace ~= nil then ws_manager.leave() end
|
||||
CODEMP.client = nil
|
||||
collectgarbage("collect") -- to make sure we drop the reference and disconnect
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue