Skip to content

Commit

Permalink
fix: replace deprecated vim.lsp.get_active_clients #57 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedrzejboczar authored May 26, 2024
1 parent b14d340 commit 46dd09d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/possession/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@ function M.prompt_yes_no(prompt, callback)
end
end

---@param filter? vim.lsp.get_clients.Filter
local function lsp_get_clients(filter)
if vim.fn.has('nvim-0.10') ~= 0 then
return vim.lsp.get_clients(filter)
else
return vim.lsp.get_active_clients(filter)
end
end

--- Delete all open buffers, avoiding potential errors
---@param force? boolean delete buffers with unsaved changes
function M.delete_all_buffers(force)
Expand All @@ -218,7 +227,7 @@ function M.delete_all_buffers(force)
end
end
vim.api.nvim_buf_delete(current_buffer, { force = force })
vim.lsp.stop_client(vim.lsp.get_active_clients())
vim.lsp.stop_client(lsp_get_clients())
end

---@param mod string
Expand Down

0 comments on commit 46dd09d

Please sign in to comment.