feat(lsp): support custom servers
This commit is contained in:
+10
-5
@@ -196,7 +196,6 @@ function M:configure_client()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local ok, ret = pcall(lspconfig[self.name].setup, self.config.lspconfig)
|
local ok, ret = pcall(lspconfig[self.name].setup, self.config.lspconfig)
|
||||||
if not ok then
|
if not ok then
|
||||||
utils.err(
|
utils.err(
|
||||||
@@ -358,16 +357,22 @@ function M.new(name, config)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local ok, resp = pcall(require, "lspconfig.configs." .. name)
|
local ok, resp = pcall(require, "lspconfig.configs." .. name)
|
||||||
|
if not ok and config.lspconfig then
|
||||||
if not ok then
|
local configs = require("lspconfig.configs")
|
||||||
|
configs[name] = { default_config = config.lspconfig }
|
||||||
|
elseif ok then
|
||||||
|
config.lspconfig = vim.tbl_deep_extend(
|
||||||
|
"keep",
|
||||||
|
config.lspconfig or {},
|
||||||
|
resp.default_config
|
||||||
|
)
|
||||||
|
else
|
||||||
utils.err(
|
utils.err(
|
||||||
("Server with name %s does not exist in lspconfig"):format(name)
|
("Server with name %s does not exist in lspconfig"):format(name)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
config.lspconfig =
|
|
||||||
vim.tbl_deep_extend("keep", config.lspconfig or {}, resp.default_config)
|
|
||||||
local server = { name = name, config = config }
|
local server = { name = name, config = config }
|
||||||
|
|
||||||
if server.config.mason then
|
if server.config.mason then
|
||||||
|
|||||||
Reference in New Issue
Block a user