From 84c6a969a0c375a71eea4328cf656f20deabe1da Mon Sep 17 00:00:00 2001 From: Oscar Wallberg Date: Wed, 21 May 2025 05:16:01 +0200 Subject: [PATCH] feat(lsp): support custom servers --- lua/ow/lsp/server.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lua/ow/lsp/server.lua b/lua/ow/lsp/server.lua index e8178da..3f24053 100644 --- a/lua/ow/lsp/server.lua +++ b/lua/ow/lsp/server.lua @@ -196,7 +196,6 @@ function M:configure_client() end end - local ok, ret = pcall(lspconfig[self.name].setup, self.config.lspconfig) if not ok then utils.err( @@ -358,16 +357,22 @@ function M.new(name, config) end local ok, resp = pcall(require, "lspconfig.configs." .. name) - - if not ok then + if not ok and config.lspconfig 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( ("Server with name %s does not exist in lspconfig"):format(name) ) return end - config.lspconfig = - vim.tbl_deep_extend("keep", config.lspconfig or {}, resp.default_config) local server = { name = name, config = config } if server.config.mason then