diff --git a/lua/navigator/lspclient/clients.lua b/lua/navigator/lspclient/clients.lua index 3bd1d2d..1dad255 100644 --- a/lua/navigator/lspclient/clients.lua +++ b/lua/navigator/lspclient/clients.lua @@ -442,7 +442,13 @@ local function lsp_startup(ft, retry, user_lsp_opts) goto continue end end - if user_lsp_opts[lspclient] ~= nil and user_lsp_opts[lspclient].filetypes ~= nil then + + -- for lazy loading + -- e.g. {lsp={tsserver=function() if tsver>'1.17' then return {xxx} else return {xxx} end}} + if type(user_lsp_opts[lspclient]) == 'function' then + user_lsp_opts[lspclient] = user_lsp_opts[lspclient]() + trace('loading from func:', user_lsp_opts[lspclient]) + elseif user_lsp_opts[lspclient] ~= nil and user_lsp_opts[lspclient].filetypes ~= nil then if not vim.tbl_contains(user_lsp_opts[lspclient].filetypes, ft) then trace('ft', ft, 'disabled for', lspclient) goto continue