Skip to content

Commit 3ddda4a

Browse files
authored
update: remove client_supports_method (#1810)
Neovim 0.11 is now stable
1 parent 5740ddc commit 3ddda4a

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

init.lua

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -572,26 +572,13 @@ require('lazy').setup({
572572
-- the definition of its *type*, not where it was *defined*.
573573
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
574574

575-
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
576-
---@param client vim.lsp.Client
577-
---@param method vim.lsp.protocol.Method
578-
---@param bufnr? integer some lsp support methods only in specific files
579-
---@return boolean
580-
local function client_supports_method(client, method, bufnr)
581-
if vim.fn.has 'nvim-0.11' == 1 then
582-
return client:supports_method(method, bufnr)
583-
else
584-
return client.supports_method(method, { bufnr = bufnr })
585-
end
586-
end
587-
588575
-- The following two autocommands are used to highlight references of the
589576
-- word under your cursor when your cursor rests there for a little while.
590577
-- See `:help CursorHold` for information about when this is executed
591578
--
592579
-- When you move your cursor, the highlights will be cleared (the second autocommand).
593580
local client = vim.lsp.get_client_by_id(event.data.client_id)
594-
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
581+
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
595582
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
596583
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
597584
buffer = event.buf,
@@ -618,7 +605,7 @@ require('lazy').setup({
618605
-- code, if the language server you are using supports them
619606
--
620607
-- This may be unwanted, since they displace some of your code
621-
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
608+
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
622609
map('<leader>th', function()
623610
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
624611
end, '[T]oggle Inlay [H]ints')

0 commit comments

Comments
 (0)