nvim: lsp: Non-method client functions are deprecated

We have no idea what non method client functions are or
imply in the context of Lua but who cares.
This commit is contained in:
Sanchayan Maity 2024-12-21 12:40:51 +05:30
parent 66b7b0ae89
commit 65df9845f7
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -161,12 +161,12 @@ local on_attach = function(client_id, client, bufnr)
for _, mappings in pairs(lsp_key_mappings) do for _, mappings in pairs(lsp_key_mappings) do
local capability, mode, lhs, rhs = unpack(mappings) local capability, mode, lhs, rhs = unpack(mappings)
if client.supports_method(capability) then if client:supports_method(capability) then
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts)
end end
end end
if client.supports_method('textDocument/codeLens') then if client:supports_method('textDocument/codeLens') then
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, { vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
group = lsp_augroup_id, group = lsp_augroup_id,
buffer = bufnr, buffer = bufnr,
@ -174,7 +174,7 @@ local on_attach = function(client_id, client, bufnr)
}) })
end end
if client.supports_method('textDocument/documentHighlight') then if client:supports_method('textDocument/documentHighlight') then
vim.api.nvim_create_autocmd("CursorHold", { vim.api.nvim_create_autocmd("CursorHold", {
group = lsp_augroup_id, group = lsp_augroup_id,
buffer = bufnr, buffer = bufnr,
@ -187,7 +187,7 @@ local on_attach = function(client_id, client, bufnr)
}) })
end end
if client.supports_method('textDocument/inlayHint') then if client:supports_method('textDocument/inlayHint') then
vim.lsp.inlay_hint.enable(false) vim.lsp.inlay_hint.enable(false)
end end
end end
@ -210,7 +210,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
for _, mappings in pairs(lsp_key_mappings) do for _, mappings in pairs(lsp_key_mappings) do
local capability, mode, lhs, rhs = unpack(mappings) local capability, mode, lhs, rhs = unpack(mappings)
if client.supports_method(capability) then if client:supports_method(capability) then
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts) vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts)
end end
end end
@ -236,7 +236,7 @@ vim.api.nvim_create_autocmd("LspDetach", {
for _, mappings in pairs(lsp_key_mappings) do for _, mappings in pairs(lsp_key_mappings) do
local capability, mode, lhs, _ = unpack(mappings) local capability, mode, lhs, _ = unpack(mappings)
if client.supports_method(capability) then if client:supports_method(capability) then
vim.api.nvim_buf_del_keymap(bufnr, mode, lhs) vim.api.nvim_buf_del_keymap(bufnr, mode, lhs)
end end
end end