From 564f03e39b02254919868850dd8089d018bd0e4e Mon Sep 17 00:00:00 2001 From: William Boman Date: Mon, 23 Aug 2021 06:53:11 +0200 Subject: eslintls: defer registering server definition with lspconfig (#62) Resolves #61. --- lua/nvim-lsp-installer/server.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lua/nvim-lsp-installer/server.lua') diff --git a/lua/nvim-lsp-installer/server.lua b/lua/nvim-lsp-installer/server.lua index edc80253..5aa75825 100644 --- a/lua/nvim-lsp-installer/server.lua +++ b/lua/nvim-lsp-installer/server.lua @@ -31,6 +31,9 @@ M.Server.__index = M.Server -- Use this to defer setting up server specific things until they're actually -- needed, like custom commands. -- +-- @field pre_setup (function) An optional function to be executed prior to calling lspconfig's setup(). +-- Use this to defer setting up server specific things until they're actually needed. +-- function M.Server:new(opts) return setmetatable({ name = opts.name, @@ -39,10 +42,14 @@ function M.Server:new(opts) _default_options = opts.default_options, _pre_install_check = opts.pre_install_check, _post_setup = opts.post_setup, + _pre_setup = opts.pre_setup, }, M.Server) end function M.Server:setup(opts) + if self._pre_setup then + self._pre_setup() + end -- 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. -- cgit v1.2.3-70-g09d2