Skip to content

Commit 3ac437e

Browse files
committed
fix: end powershell process when detaching from last buffer
1 parent 7c522df commit 3ac437e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lua/powershell/lsp.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ M.initialize_or_attach = function(buf)
322322
local client = vim.lsp.get_client_by_id(client_id)
323323
if not client then return end
324324
local attached_buffers = iter(pairs(client.attached_buffers)):map(function(buf) return buf end):totable()
325-
if #attached_buffers == 0 then util.all_session_details[root_dir] = nil end
325+
if #attached_buffers == 1 and attached_buffers[1] == opts.buf then
326+
util.all_session_details[root_dir] = nil
327+
vim.schedule(function() api.nvim_buf_delete(term_buf, { force = true }) end)
328+
end
326329

327330
return true
328331
end

0 commit comments

Comments
 (0)