From a0fa3d278a81e7df8235238b4ce902f2d6484774 Mon Sep 17 00:00:00 2001 From: ray-x Date: Mon, 5 Jul 2021 10:08:34 +1000 Subject: [PATCH] retry client setup --- lua/navigator/lspclient/clients.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/navigator/lspclient/clients.lua b/lua/navigator/lspclient/clients.lua index 552347e..bcc94ef 100644 --- a/lua/navigator/lspclient/clients.lua +++ b/lua/navigator/lspclient/clients.lua @@ -274,7 +274,16 @@ local function load_cfg(ft, client, cfg, loaded) return end end + + if lspconfig[client] == nil then + error("client " .. client .. " not supported") + end + lspconfig[client].setup(cfg) + -- I dont know why but 1st time setup may fail.. + vim.defer_fn(function() + lspconfig[client].setup(cfg) + end, 200) log(client, "loading for", ft) end end @@ -327,7 +336,8 @@ local function wait_lsp_startup(ft, retry, lsp_opts) _Loading = false return true end - _Loading = false + -- giveup + -- _Loading = false end) end @@ -394,7 +404,9 @@ local function setup(user_opts) end end end + wait_lsp_startup(ft, retry, lsp_opts) + _LoadedClients[ft] = true _Loading = false