diff --git a/lua/yazi/lsp/delete.lua b/lua/yazi/lsp/delete.lua index c0c08fc8..b15bc886 100644 --- a/lua/yazi/lsp/delete.lua +++ b/lua/yazi/lsp/delete.lua @@ -1,5 +1,3 @@ -local lsp_util = require('yazi.lsp.lsp_util') - local M = {} ---@param path string @@ -7,7 +5,10 @@ local function notify_file_was_deleted(path) -- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_willDeleteFiles local method = 'workspace/willDeleteFiles' - local clients = lsp_util.get_clients(method, vim.api.nvim_get_current_buf()) + local clients = vim.lsp.get_clients({ + method = method, + bufnr = vim.api.nvim_get_current_buf(), + }) for _, client in ipairs(clients) do local resp = client.request_sync(method, { @@ -29,7 +30,10 @@ local function notify_delete_complete(path) -- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didDeleteFiles local method = 'workspace/didDeleteFiles' - local clients = lsp_util.get_clients(method, vim.api.nvim_get_current_buf()) + local clients = vim.lsp.get_clients({ + method = method, + bufnr = vim.api.nvim_get_current_buf(), + }) for _, client in ipairs(clients) do -- NOTE: this returns nothing, so no need to do anything with the response diff --git a/lua/yazi/lsp/lsp_util.lua b/lua/yazi/lsp/lsp_util.lua deleted file mode 100644 index b3f0d442..00000000 --- a/lua/yazi/lsp/lsp_util.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} - --- For nvim 0.9 compatibility ----@param lsp_method string -function M.get_clients(lsp_method) - -- TODO remove this when we drop support for nvim 0.9 - - ---@diagnostic disable-next-line: deprecated - but needed for compatibility - local clients = vim.lsp.get_active_clients() - return vim.tbl_filter(function(client) - return client.supports_method(lsp_method) - end, clients) -end - -return M diff --git a/lua/yazi/lsp/rename.lua b/lua/yazi/lsp/rename.lua index 50cf7104..ac05ade5 100644 --- a/lua/yazi/lsp/rename.lua +++ b/lua/yazi/lsp/rename.lua @@ -1,5 +1,3 @@ -local lsp_util = require('yazi.lsp.lsp_util') - local M = {} ---@param from string @@ -8,7 +6,10 @@ local function notify_file_was_renamed(from, to) -- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_willRenameFiles local method = 'workspace/willRenameFiles' - local clients = lsp_util.get_clients(method) + local clients = vim.lsp.get_clients({ + method = method, + bufnr = vim.api.nvim_get_current_buf(), + }) for _, client in ipairs(clients) do local resp = client.request_sync(method, { @@ -32,7 +33,10 @@ local function notify_rename_complete(from, to) -- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didRenameFiles local method = 'workspace/didRenameFiles' - local clients = lsp_util.get_clients(method) + local clients = vim.lsp.get_clients({ + method = method, + bufnr = vim.api.nvim_get_current_buf(), + }) for _, client in ipairs(clients) do -- NOTE: this returns nothing, so no need to do anything with the response