aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/server.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-09-10 14:56:11 +0200
committerWilliam Boman <william@redwill.se>2021-09-10 14:56:11 +0200
commitfef264fdb877ed5ef87eafdb8b76991077044e39 (patch)
treef37106b4a410985022736a10f27363ee14cd0686 /lua/nvim-lsp-installer/server.lua
parentdispatcher: pcall callback and log exceptions (diff)
downloadmason-fef264fdb877ed5ef87eafdb8b76991077044e39.tar
mason-fef264fdb877ed5ef87eafdb8b76991077044e39.tar.gz
mason-fef264fdb877ed5ef87eafdb8b76991077044e39.tar.bz2
mason-fef264fdb877ed5ef87eafdb8b76991077044e39.tar.lz
mason-fef264fdb877ed5ef87eafdb8b76991077044e39.tar.xz
mason-fef264fdb877ed5ef87eafdb8b76991077044e39.tar.zst
mason-fef264fdb877ed5ef87eafdb8b76991077044e39.zip
eslintls: fix setting up a reinstallation of the server
Diffstat (limited to 'lua/nvim-lsp-installer/server.lua')
-rw-r--r--lua/nvim-lsp-installer/server.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/lua/nvim-lsp-installer/server.lua b/lua/nvim-lsp-installer/server.lua
index 2e1a477c..d707d141 100644
--- a/lua/nvim-lsp-installer/server.lua
+++ b/lua/nvim-lsp-installer/server.lua
@@ -52,9 +52,14 @@ function M.Server:setup(opts)
-- We require the lspconfig server here in order to do it as late as possible.
-- The reason for this is because once a lspconfig server has been imported, it's
-- automatically registered with lspconfig and causes it to show up in :LspInfo and whatnot.
- require("lspconfig")[self.name].setup(vim.tbl_deep_extend("force", self._default_options, opts or {}))
- if self._post_setup then
- self._post_setup()
+ local lsp_server = require("lspconfig")[self.name]
+ if lsp_server then
+ lsp_server.setup(vim.tbl_deep_extend("force", self._default_options, opts or {}))
+ if self._post_setup then
+ self._post_setup()
+ end
+ else
+ error(("Unable to setup server %q: Could not find lspconfig server entry."):format(self.name))
end
end