From f9baadcba865c2ab1211c44e021b935c77588fad Mon Sep 17 00:00:00 2001 From: Milan <78668826+milanfusco@users.noreply.github.com> Date: Sat, 1 Feb 2025 15:06:58 -0500 Subject: [PATCH] Replace deprecated vim.lsp.buf_get_clients with vim.lsp.get_clients Neovim has deprecated the use of vim.lsp.buf_get_clients() in favor of vim.lsp.get_clients(), and this change removes the deprecation warning triggered by lsp-status.nvim. Updating to the new API helps ensure compatibility with future Neovim releases (e.g., 0.12 and later). Changes: - Replaced all occurrences of vim.lsp.buf_get_clients() with vim.lsp.get_clients() in the lsp-status plugin (in statusline.lua and other related modules). - Verified that the new function correctly returns the active LSP clients, maintaining existing functionality. - Tested with NVIM v0.11.0-dev-736+g648d6426c (RelWithDebInfo build, LuaJIT 2.1.1724512491) - Confirmed that deprecation warnings are no longer emitted during startup. --- lua/lsp-status/statusline.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lsp-status/statusline.lua b/lua/lsp-status/statusline.lua index 1526bd8..c62c29a 100644 --- a/lua/lsp-status/statusline.lua +++ b/lua/lsp-status/statusline.lua @@ -76,7 +76,7 @@ end local function get_lsp_statusline(bufnr) bufnr = bufnr or 0 - if vim.tbl_count(vim.lsp.buf_get_clients(bufnr)) == 0 then return '' end + if vim.tbl_count(vim.lsp.get_clients(bufnr)) == 0 then return '' end local buf_diagnostics = config.diagnostics and diagnostics(bufnr) or nil local only_hint = true local some_diagnostics = false