From 50a36d3faab443638763c59027c4d5fa258201f1 Mon Sep 17 00:00:00 2001 From: orip Date: Tue, 8 Jul 2025 01:07:14 +0300 Subject: [PATCH] Raise the minimum nvim version to 0.11 --- init.lua | 17 ++--------------- lua/kickstart/health.lua | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/init.lua b/init.lua index d6e9adbe..82ea486c 100644 --- a/init.lua +++ b/init.lua @@ -591,26 +591,13 @@ require('lazy').setup({ -- Toggle to show/hide diagnostic messages map('td', function() vim.diagnostic.enable(not vim.diagnostic.is_enabled()) end, '[T]oggle [D]iagnostics') - -- 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, @@ -637,7 +624,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') end end, 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))