mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-29 12:10:12 +02:00
feat(lsp): automatically resolve denols/tsserver conflicts if both are configured
This commit is contained in:
parent
c7aeda9db1
commit
d565684ade
2 changed files with 27 additions and 1 deletions
|
@ -196,4 +196,21 @@ function M.lazy_notify()
|
|||
timer:start(500, 0, replay)
|
||||
end
|
||||
|
||||
function M.lsp_get_config(server)
|
||||
local configs = require("lspconfig.configs")
|
||||
return rawget(configs, server)
|
||||
end
|
||||
|
||||
---@param server string
|
||||
---@param cond fun( root_dir, config): boolean
|
||||
function M.lsp_disable(server, cond)
|
||||
local util = require("lspconfig.util")
|
||||
local def = M.lsp_get_config(server)
|
||||
def.document_config.on_new_config = util.add_hook_before(def.document_config.on_new_config, function(config, root_dir)
|
||||
if cond(root_dir, config) then
|
||||
config.enabled = false
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue