aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/server.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-08-17 14:37:54 +0200
committerGitHub <noreply@github.com>2021-08-17 14:37:54 +0200
commit0625608caed54b393f74c5fb3404ba87e288270e (patch)
tree0e5abab4f9eaf4ae3150041fc97a154409057014 /lua/nvim-lsp-installer/server.lua
parentimprove messages (diff)
downloadmason-0625608caed54b393f74c5fb3404ba87e288270e.tar
mason-0625608caed54b393f74c5fb3404ba87e288270e.tar.gz
mason-0625608caed54b393f74c5fb3404ba87e288270e.tar.bz2
mason-0625608caed54b393f74c5fb3404ba87e288270e.tar.lz
mason-0625608caed54b393f74c5fb3404ba87e288270e.tar.xz
mason-0625608caed54b393f74c5fb3404ba87e288270e.tar.zst
mason-0625608caed54b393f74c5fb3404ba87e288270e.zip
add tflint (#52)
* add tflint * Update lua/nvim-lsp-installer/servers/tflint/init.lua
Diffstat (limited to 'lua/nvim-lsp-installer/server.lua')
-rw-r--r--lua/nvim-lsp-installer/server.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/server.lua b/lua/nvim-lsp-installer/server.lua
index e4e684b3..8b72ce53 100644
--- a/lua/nvim-lsp-installer/server.lua
+++ b/lua/nvim-lsp-installer/server.lua
@@ -25,6 +25,11 @@ M.Server.__index = M.Server
--
-- @field pre_install_check (function) An optional function to be executed before the installer. This allows ensuring that any prerequisites are fulfilled.
-- This could for example be verifying that required build tools are installed.
+--
+-- @field post_setup (function) An optional function to be executed after the setup function has been successfully called.
+-- Use this to defer setting up server specific things until they're actually
+-- needed, like custom commands.
+--
function M.Server:new(opts)
return setmetatable({
name = opts.name,
@@ -32,6 +37,7 @@ function M.Server:new(opts)
_root_dir = opts.root_dir,
_default_options = opts.default_options,
_pre_install_check = opts.pre_install_check,
+ _post_setup = opts.post_setup,
}, M.Server)
end
@@ -40,6 +46,9 @@ function M.Server:setup(opts)
-- 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))
+ if self._post_setup then
+ self._post_setup()
+ end
end
function M.Server:get_default_options()