mirror of
https://github.com/neovim/neovim.git
synced 2026-01-25 14:16:04 +00:00
feat(lsp): vim.lsp.is_enabled() #33703
Problem:
No way to check if a LSP config is enabled without causing it to
resolve. E.g. `vim.lsp.config['…'] ~= nil` will resolve the config,
which could be an unwanted and somewhat expensive side-effect.
Solution:
Introduce `vim.lsp.is_enabled()`.
(cherry picked from commit 03d378fda6)
This commit is contained in:
committed by
github-actions[bot]
parent
3a4d3934c4
commit
4e43264cd3
@@ -615,6 +615,14 @@ function lsp.enable(name, enable)
|
||||
end
|
||||
end
|
||||
|
||||
--- Checks if the given LSP config is enabled (globally, not per-buffer).
|
||||
---
|
||||
--- @param name string Config name
|
||||
--- @return boolean
|
||||
function lsp.is_enabled(name)
|
||||
return lsp._enabled_configs[name] ~= nil
|
||||
end
|
||||
|
||||
--- @class vim.lsp.start.Opts
|
||||
--- @inlinedoc
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user