diff --git a/init.lua b/init.lua index b98ffc61..18e0a611 100644 --- a/init.lua +++ b/init.lua @@ -572,26 +572,13 @@ require('lazy').setup({ -- the definition of its *type*, not where it was *defined*. map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) - ---@param client vim.lsp.Client - ---@param method vim.lsp.protocol.Method - ---@param bufnr? integer some lsp support methods only in specific files - ---@return boolean - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, bufnr) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end - -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed -- -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, @@ -618,7 +605,7 @@ require('lazy').setup({ -- code, if the language server you are using supports them -- -- This may be unwanted, since they displace some of your code - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua index b59d0864..ca684516 100644 --- a/lua/kickstart/health.lua +++ b/lua/kickstart/health.lua @@ -12,7 +12,7 @@ local check_version = function() return end - if vim.version.ge(vim.version(), '0.10-dev') then + if vim.version.ge(vim.version(), '0.11') then vim.health.ok(string.format("Neovim version is: '%s'", verstr)) else vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))