fix(lsp): migrate to vim.lsp.config and clear startup crash#2053
Closed
tmas333 wants to merge 12 commits into
Closed
fix(lsp): migrate to vim.lsp.config and clear startup crash#2053tmas333 wants to merge 12 commits into
tmas333 wants to merge 12 commits into
Conversation
Opening Neovim crashed at init.lua:664 because nvim-lspconfig's
require('lspconfig').<server>.setup() framework is deprecated on
nvim 0.11 and slated for removal in v3.0.0. The same lspconfig
update ships a community lsp/stylua.lua, so the mason-lspconfig
handler was launching the stylua formatter with --lsp and getting
exit code 2 on every startup.
Replace the lspconfig + mason-lspconfig handler path with the
native 0.11 API: register each server via vim.lsp.config() and
activate via vim.lsp.enable(). Fold ruff and basedpyright into the
servers table so they share the blink.cmp capability merge and
mason auto-install. Stylua stays in the mason-tool-installer list
for conform.nvim to consume; nothing ever enables it as an LSP.
Bundle accumulated plugin work that had been sitting in the working tree: add CodeCompanion, golf, neotest (with rustaceanvim adapter), nvim-bacon, vim-pencil, and quickscope; bump rustaceanvim to ^6 with clippy/rustfmt settings and a neotest dependency; add an Obsidian checkbox order; rework trouble keymaps to free <leader>xx and add a sidebar diagnostic toggle. Drop cyberdream — tokyonight is the current colorscheme.
Author
|
Closing — opened against upstream by mistake, this should target my fork. Sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Neovim was crashing on startup with a stack trace ending at
init.lua:664, and two LSP clients (stylua,Copilot) were dying every session. This PR fixes the crash and the spuriousstyluaLSP client, and bundles accumulated plugin work that had been lingering in the working tree.What was broken
require('lspconfig').<server>.setup()is deprecated on nvim 0.11 and will be removed in nvim-lspconfig v3.0.0. The framework's__indexwas already raising on.ruff/.basedpyright, producing the stack trace.nvim-lspconfignow ships a communitylsp/stylua.luadefinition. The oldmason-lspconfighandlersblock was iterating over every mason-installed package whose name matched a known lspconfig server — so the stylua formatter was being launched as an LSP server with--lsp, exiting 2 every startup.Copilot: Process exited with status 243) is an npm cache permission issue on the local machine (EACCESon~/.npm/_npx/...). Not a config bug — see verification notes below.What this PR does
Commit 1 —
fix(lsp)(init.lua only)require('lspconfig').xxx.setup(...)pattern with native 0.11 API:vim.lsp.config(name, cfg)+vim.lsp.enable(name).ruffandbasedpyrightinto the mainserverstable so they get the blink.cmp capability merge and Mason auto-install like everything else.mason-lspconfig.setup { handlers = ... }entirely. With handlers gone, only names explicitly handed tovim.lsp.enableare ever launched —styluacannot be mis-started as an LSP again. It stays inmason-tool-installer's list as a formatter for conform.nvim.Commit 2 —
chore(plugins)(everything else that was sitting in the working tree)code_companion,golf,neotest(rustaceanvim adapter),nvim-bacon,vim-pencil,quickscope.rustaceanvim→^6with clippy/rustfmt config + neotest dep;obsidiancheckbox order;troublekeymaps reworked (<leader>xx→<leader>xd, add<leader>xlsidebar toggle).cyberdream(tokyonight is the active colorscheme now).Test plan
sudo chown -R 501:20 ~/.npm— fixes the Copilot 243 error (root-owned files in~/.npm/_npx/). This is system state, not in the diff.nvimfrom$HOME— no stack trace, no deprecation warning, noClient stylua quitnotification..luafile →:LspInfoshowslua_lsattached and nostyluaclient..pyfile →:LspInfoshows bothruffandbasedpyright..tf, ansible.yml, plain.yaml→ corresponding server attaches.<leader>fon a Lua file still formats via stylua (through conform.nvim).:Masonlistsruff,basedpyright,stylua,lua-language-server,terraform-ls,tflint,ansible-language-server,yaml-language-serverall installed.:checkhealth lspclean.:CopilotChatopens without spawning a 243 exit, and~/.local/state/nvim/lsp.logshows no newstylua --lsporEACCESerrors.🤖 Generated with Claude Code