neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 34116bbd9b61ec78233b86dcadec6eb5eaf1571d
parent e2bc84e3156032d78891bc52ff466b9e552140cf
Author: Olivia Kinnear <git@superatomic.dev>
Date:   Thu, 22 Jan 2026 14:27:03 -0600

fix(lsp): fix nil-index error for `:lsp enable` (#37411)

Problem:
`:lsp enable` with no arguments will fail if there is a invalid config
in `lsp/`, or if `vim.lsp.config[...]` returns nil for any other reason.

Solution:
Add a nil-check to `:lsp enable`.
Diffstat:
Mruntime/lua/vim/_core/ex_cmd.lua | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/runtime/lua/vim/_core/ex_cmd.lua b/runtime/lua/vim/_core/ex_cmd.lua @@ -79,9 +79,14 @@ local function ex_lsp_enable(config_names) if #config_names == 0 then local filetype = vim.bo.filetype for _, name in ipairs(get_config_names()) do - local filetypes = lsp.config[name].filetypes - if filetypes == nil or vim.list_contains(filetypes, filetype) then - table.insert(config_names, name) + local config = lsp.config[name] + if config then + local filetypes = config.filetypes + if filetypes == nil or vim.list_contains(filetypes, filetype) then + table.insert(config_names, name) + end + else + echo_err(("Unable to check filetype for '%s': Broken config"):format(name)) end end if #config_names == 0 then