Skip to content

[audit] nvim-lspconfig may be vestigial — 6 servers enabled without explicit vim.lsp.config() definitions #145

@stanfish06

Description

@stanfish06

What

lua/config/plugin_config.lua uses the Neovim 0.11+ built-in vim.lsp.config() / vim.lsp.enable() API for all language servers. However, only luals and sourcekit have an explicit vim.lsp.config[name] = { ... } definition. The remaining six are simply enabled:

vim.lsp.enable("pyright")
vim.lsp.enable("pyrefly")   -- ← high-risk: likely not in lspconfig yet
vim.lsp.enable("clangd")
vim.lsp.enable("ts_ls")
vim.lsp.enable("rust_analyzer")
vim.lsp.enable("gopls")

Where

  • lua/config/plugins.lua:12nvim-lspconfig still listed as a dependency
  • lua/config/plugin_config.lua:88–99 — six vim.lsp.enable() calls with no prior vim.lsp.config() for each

Why it matters

vim.lsp.enable() in Neovim 0.11+ requires that a config is registered first. For well-known servers (pyright, clangd, ts_ls, rust_analyzer, gopls), nvim-lspconfig auto-registers its bundled defaults into vim.lsp.config at load time — so the plugin is load-bearing even though require("lspconfig") is never called explicitly.

pyrefly is the highest-risk case: it is a newer server that was not in nvim-lspconfig as of early 2025. If it has no lspconfig entry, vim.lsp.enable("pyrefly") silently does nothing (no error, no server).

Recommended actions

  1. Verify pyrefly has an nvim-lspconfig entry (nvim-lspconfig/lua/lspconfig/configs/pyrefly.lua). If not, add an explicit vim.lsp.config("pyrefly", { cmd = {"pyrefly", "lsp"}, filetypes = {"python"}, root_markers = {"pyproject.toml", ".git"} }) before the enable() call.
  2. Audit whether nvim-lspconfig can be removed entirely by converting each implicit server to an explicit vim.lsp.config() block — this would eliminate a plugin with no direct require() anywhere in the config.
  3. Document the dependency clearly in a comment near the lspconfig plugin entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions