mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
fix(lsp): fix deprecated warnings related to lsp client
This commit is contained in:
parent
bc0630e43b
commit
07fefd2a99
2 changed files with 12 additions and 5 deletions
|
|
@ -43,7 +43,7 @@ local function wrap(client)
|
|||
if client.wrapped then
|
||||
return client
|
||||
end
|
||||
local methods = { "request", "supports_method", "cancel_request" }
|
||||
local methods = { "request", "supports_method", "cancel_request", "notify" }
|
||||
-- old style
|
||||
return setmetatable({ wrapped = true }, {
|
||||
__index = function(_, k)
|
||||
|
|
|
|||
|
|
@ -106,10 +106,17 @@ function M.is_enabled(opts)
|
|||
if not config.filter(buf) then
|
||||
return false
|
||||
end
|
||||
local clients = (vim.lsp.get_clients or vim.lsp.get_active_clients)({ bufnr = buf })
|
||||
clients = vim.tbl_filter(function(client)
|
||||
return client.supports_method("textDocument/documentHighlight", { bufnr = buf })
|
||||
end, clients)
|
||||
|
||||
local clients = {} ---@type vim.lsp.Client[]
|
||||
if vim.fn.has("nvim-0.11") == 1 then
|
||||
clients = vim.lsp.get_clients({ bufnr = buf, method = "textDocument/documentHighlight" })
|
||||
else
|
||||
clients = (vim.lsp.get_clients or vim.lsp.get_active_clients)({ bufnr = buf })
|
||||
clients = vim.tbl_filter(function(client)
|
||||
return client.supports_method("textDocument/documentHighlight", { bufnr = buf })
|
||||
end, clients)
|
||||
end
|
||||
|
||||
return #clients > 0
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue