mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	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.
			
			
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user