Skip to content

Commit 7e2cbf9

Browse files
VlaDexammirusmrr11kqgates
authored andcommitted
Neovim 0.10 updates (nvim-lua#936)
* Neovim 0.10 updates Provide the buffer for which to enable inlay hints Co-authored-by: Matt Mirus <[email protected]> * refactor: replace vim.loop with vim.uv * Upgrade folke/neodev (sunsetting) to folke/lazydev * Update checkhealth for 0.10 release --------- Co-authored-by: Matt Mirus <[email protected]> Co-authored-by: mrr11k <[email protected]> Co-authored-by: Seb Tomasini <[email protected]>
1 parent b6a4b3c commit 7e2cbf9

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

init.lua

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ vim.opt.hlsearch = true
162162
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
163163

164164
-- Diagnostic keymaps
165-
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
166-
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
167-
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
168165
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
169166

170167
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
@@ -207,7 +204,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
207204
-- [[ Install `lazy.nvim` plugin manager ]]
208205
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
209206
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
210-
if not vim.loop.fs_stat(lazypath) then
207+
if not vim.uv.fs_stat(lazypath) then
211208
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
212209
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
213210
if vim.v.shell_error ~= 0 then
@@ -238,11 +235,6 @@ require('lazy').setup({
238235
--
239236
-- Use `opts = {}` to force a plugin to be loaded.
240237
--
241-
-- This is equivalent to:
242-
-- require('Comment').setup({})
243-
244-
-- "gc" to comment visual regions/lines
245-
{ 'numToStr/Comment.nvim', opts = {} },
246238

247239
-- Here is a more advanced example where we pass configuration
248240
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
@@ -420,9 +412,9 @@ require('lazy').setup({
420412
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
421413
{ 'j-hui/fidget.nvim', opts = {} },
422414

423-
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
415+
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
424416
-- used for completion, annotations and signatures of Neovim apis
425-
{ 'folke/neodev.nvim', opts = {} },
417+
{ 'folke/lazydev.nvim', ft = 'lua', opts = {} },
426418
},
427419
config = function()
428420
-- Brief aside: **What is LSP?**
@@ -499,10 +491,6 @@ require('lazy').setup({
499491
-- or a suggestion from your LSP for this to activate.
500492
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
501493

502-
-- Opens a popup that displays documentation about the word under your cursor
503-
-- See `:help K` for why this keymap.
504-
map('K', vim.lsp.buf.hover, 'Hover Documentation')
505-
506494
-- WARN: This is not Goto Definition, this is Goto Declaration.
507495
-- For example, in C this would take you to the header.
508496
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
@@ -513,7 +501,7 @@ require('lazy').setup({
513501
--
514502
-- When you move your cursor, the highlights will be cleared (the second autocommand).
515503
local client = vim.lsp.get_client_by_id(event.data.client_id)
516-
if client and client.server_capabilities.documentHighlightProvider then
504+
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
517505
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
518506
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
519507
buffer = event.buf,
@@ -540,9 +528,9 @@ require('lazy').setup({
540528
-- code, if the language server you are using supports them
541529
--
542530
-- This may be unwanted, since they displace some of your code
543-
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
531+
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
544532
map('<leader>th', function()
545-
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
533+
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
546534
end, '[T]oggle Inlay [H]ints')
547535
end
548536
end,
@@ -766,6 +754,11 @@ require('lazy').setup({
766754
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
767755
},
768756
sources = {
757+
{
758+
name = 'lazydev',
759+
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
760+
group_index = 0,
761+
},
769762
{ name = 'nvim_lsp' },
770763
{ name = 'luasnip' },
771764
{ name = 'path' },

lua/kickstart/health.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
--]]
77

88
local check_version = function()
9-
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
10-
if not vim.version.cmp then
9+
local verstr = tostring(vim.version())
10+
if not vim.version.ge then
1111
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
1212
return
1313
end
1414

15-
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
15+
if vim.version.ge(vim.version(), '0.10-dev') then
1616
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
1717
else
1818
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))

0 commit comments

Comments
 (0)