Skip to content

Commit c19f945

Browse files
committed
fix: replace deprecated vim.lsp.get_active_clients with vim.lsp.get_clients
1 parent 3aa6df5 commit c19f945

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lua/flutter-tools/lsp/utils.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ local lsp = vim.lsp
44

55
M.SERVER_NAME = "dartls"
66

7+
-- TODO: Remove after compatibility with Neovim=0.9 is dropped
8+
local get_clients = vim.fn.has("nvim-0.10") == 1 and lsp.get_clients or lsp.get_active_clients
9+
710
---@param bufnr number?
8-
---@return lsp.Client?
9-
function M.get_dartls_client(bufnr)
10-
return lsp.get_active_clients({ name = M.SERVER_NAME, bufnr = bufnr })[1]
11-
end
11+
---@return vim.lsp.Client?
12+
function M.get_dartls_client(bufnr) return get_clients({ name = M.SERVER_NAME, bufnr = bufnr })[1] end
1213

1314
return M

0 commit comments

Comments
 (0)