Skip to content

Commit

Permalink
fix calls to deprecated API
Browse files Browse the repository at this point in the history
from neovim 0.12 onwards, `vim.lsp.get_active_clients()` is deprecated.
This commit replaces the corresponding calls by ones to the updated API.

fixes jhofscheier#16
  • Loading branch information
pazz committed Nov 14, 2024
1 parent 8c6ef83 commit f0687cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/ltex-utils/diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local M = {}
function M.get_ltex_namespace(bufnr)
---@type integer
local id
for _, client in ipairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do
for _, client in ipairs(vim.lsp.get_clients({ bufnr = bufnr })) do
if client.name == "ltex" then
id = client.id
break
Expand Down
4 changes: 3 additions & 1 deletion lua/ltex-utils/ltex_lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ local M = {}
---Returns the first active LTeX LSP client attached to a buffer.
---NOTE: vim.lsp.buf_get_clients() is deprecated;
---use vim.lsp.get_active_clients instead.
---NOTE: vim.lsp.get_active_clients is deprecated form nvim 0.12;
---use vim.lsp.get_clients instead.
---@param bufnr integer|nil Buffer number; if not provided uses current buffer.
---@return table|nil # LTeX LSP client if found, otherwise nil.
function M.get_ltex(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()

for _, client in ipairs(vim.lsp.get_active_clients({ buffer = bufnr })) do
for _, client in ipairs(vim.lsp.get_clients({ bufnr = bufnr })) do
if client.name == 'ltex' then
return client
end
Expand Down

0 comments on commit f0687cb

Please sign in to comment.