diff options
author | Andrew Braxton <42975660+andrewbraxton@users.noreply.github.com> | 2025-01-15 04:58:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-15 01:58:36 -0800 |
commit | 0a7e4e9e5f28f3b6b3c83040430d0a36fcd71fad (patch) | |
tree | ef1c11425b453fa1699a05e15d6e678520f939d9 | |
parent | bc69f2723737cfe8916c117483ce32f48ff83544 (diff) | |
download | rneovim-0a7e4e9e5f28f3b6b3c83040430d0a36fcd71fad.tar.gz rneovim-0a7e4e9e5f28f3b6b3c83040430d0a36fcd71fad.tar.bz2 rneovim-0a7e4e9e5f28f3b6b3c83040430d0a36fcd71fad.zip |
fix(lsp): vim.lsp.enable(...,false) does not disable #32002
Problem:
Per the documentation, passing `false` as the `enable` parameter of
`vim.lsp.enable()` should disable the given LSP(s), but it does not work
due to a logic error.
Specifically, `enable == false and nil or {}` will always evaluate to
`{}` because `nil` is falsy.
Solution:
Correct the conditional statement.
-rw-r--r-- | runtime/lua/vim/lsp.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 7812f31db1..147d29d6be 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -546,7 +546,7 @@ function lsp.enable(name, enable) if nm == '*' then error('Invalid name') end - lsp._enabled_configs[nm] = enable == false and nil or {} + lsp._enabled_configs[nm] = enable ~= false and {} or nil end if not next(lsp._enabled_configs) then |