From 75f7c49d89e8227956d5a891501eb27e3c8a4450 Mon Sep 17 00:00:00 2001 From: Edwin van den Houdt Date: Mon, 4 May 2026 11:06:17 +0200 Subject: [PATCH] nvim: pin nvim-treesitter to v0.9.3 for nvim 0.11 compatibility --- nvim/.config/nvim/init.lua | 96 ++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 41 deletions(-) diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 66e365b..e655d22 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -148,10 +148,10 @@ require('lazy').setup({ -- -------------------------------------------------------- { 'nvim-treesitter/nvim-treesitter', + tag = 'v0.9.3', build = ':TSUpdate', config = function() require('nvim-treesitter.configs').setup { - -- Install these parsers automatically ensure_installed = { 'bash', 'lua', 'markdown', 'markdown_inline', 'typescript', 'javascript', 'c_sharp', @@ -166,62 +166,76 @@ require('lazy').setup({ -- -------------------------------------------------------- -- LSP: language server protocol -- -------------------------------------------------------- - -- mason installs language servers for you. - -- mason-lspconfig bridges mason and nvim-lspconfig. + -- mason installs language servers. + -- mason-lspconfig makes mason-installed servers available to Neovim. + -- Neovim 0.11+ has a native vim.lsp.config API — no need to call + -- lspconfig.server.setup {} anymore. { - 'neovim/nvim-lspconfig', - dependencies = { - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', - }, + 'williamboman/mason.nvim', config = function() - -- mason must be set up first require('mason').setup() + end, + }, + { + 'williamboman/mason-lspconfig.nvim', + dependencies = { 'williamboman/mason.nvim' }, + config = function() require('mason-lspconfig').setup { - -- These servers are installed automatically + -- These servers are installed automatically via mason ensure_installed = { - 'ts_ls', -- TypeScript / JavaScript - 'omnisharp', -- C# and F# - 'marksman', -- Markdown - 'lua_ls', -- Lua (for editing this config) + 'ts_ls', -- TypeScript / JavaScript + 'omnisharp', -- C# and F# + 'marksman', -- Markdown + 'lua_ls', -- Lua (for editing this config) }, } + end, + }, + { + -- nvim-lspconfig still provides default cmd/root detection per server. + -- We use it as a data source only — no setup() calls per server. + 'neovim/nvim-lspconfig', + dependencies = { 'williamboman/mason-lspconfig.nvim' }, + config = function() - -- Keymaps that only activate when an LSP attaches to a buffer + -- Server-specific settings using the native 0.11 API. + -- vim.lsp.config(name, opts) sets config for a server. + -- vim.lsp.enable(name) starts it when the right filetype opens. + + vim.lsp.config('ts_ls', {}) + + vim.lsp.config('omnisharp', { + -- Uncomment and point to your solution file if needed: + -- cmd = { 'omnisharp', '--solution-path', 'YourSolution.sln' }, + }) + + vim.lsp.config('marksman', {}) + + vim.lsp.config('lua_ls', { + settings = { + Lua = { + -- Tell the Lua LSP about Neovim's vim global + diagnostics = { globals = { 'vim' } }, + }, + }, + }) + + vim.lsp.enable({ 'ts_ls', 'omnisharp', 'marksman', 'lua_ls' }) + + -- Keymaps that activate only when an LSP attaches to a buffer vim.api.nvim_create_autocmd('LspAttach', { callback = function(event) local map = function(keys, func, desc) vim.keymap.set('n', keys, func, { buffer = event.buf, desc = desc }) end - map('gd', vim.lsp.buf.definition, 'Go to definition') - map('gD', vim.lsp.buf.declaration, 'Go to declaration') - map('gr', vim.lsp.buf.references, 'Go to references') - map('K', vim.lsp.buf.hover, 'Hover documentation') - map('rn', vim.lsp.buf.rename, 'Rename symbol') + map('gd', vim.lsp.buf.definition, 'Go to definition') + map('gD', vim.lsp.buf.declaration, 'Go to declaration') + map('gr', vim.lsp.buf.references, 'Go to references') + map('K', vim.lsp.buf.hover, 'Hover documentation') + map('rn', vim.lsp.buf.rename, 'Rename symbol') map('ca', vim.lsp.buf.code_action, 'Code action') end, }) - - -- Server-specific settings - local lspconfig = require 'lspconfig' - - lspconfig.ts_ls.setup {} - - lspconfig.omnisharp.setup { - -- Point to your solution file if needed - -- cmd = { 'omnisharp', '--solution-path', 'YourSolution.sln' }, - } - - lspconfig.marksman.setup {} - - lspconfig.lua_ls.setup { - settings = { - Lua = { - -- Teach the Lua LSP about Neovim's globals - diagnostics = { globals = { 'vim' } }, - }, - }, - } end, },