Skip to content

Commit

Permalink
use vim.lsp.get_clients when available (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
icholy authored May 17, 2024
1 parent b91f9b3 commit 0c6d8ae
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/lsplinks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ end
---@param name string
---@return boolean
local function lsp_has_capability(name)
for _, client in ipairs(vim.lsp.buf_get_clients()) do
local clients = nil
if vim.lsp.get_clients then
local bufnr = api.nvim_get_current_buf()
clients = vim.lsp.get_clients({ bufnr = bufnr })
else
clients = vim.lsp.buf_get_clients()
end
for _, client in ipairs(clients) do
if client.server_capabilities[name] then
return true
end
Expand Down

0 comments on commit 0c6d8ae

Please sign in to comment.