Skip to content

Commit

Permalink
Merge pull request #76 from SmiteshP/detach_detection
Browse files Browse the repository at this point in the history
feat: Detect that lsp server was stoped
  • Loading branch information
SmiteshP authored Aug 20, 2023
2 parents 1518458 + 69f0b07 commit b318874
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lua/nvim-navbuddy/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,21 @@ function M.attach(client, bufnr)
group = navbuddy_augroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("LspDetach", {
callback = function()
for i, c in ipairs(navbuddy_attached_clients[bufnr]) do
if c.id == client.id then
table.remove(navbuddy_attached_clients[bufnr], i)
break
end
end
if #navbuddy_attached_clients[bufnr] == 0 then
navbuddy_attached_clients[bufnr] = nil
end
end,
group = navbuddy_augroup,
buffer = bufnr,
})

vim.api.nvim_buf_create_user_command(bufnr, "Navbuddy", function()
M.open(bufnr)
Expand Down

0 comments on commit b318874

Please sign in to comment.