allow config lsp with function

neovim_0.6
ray-x 2 years ago
parent c03cbca758
commit 8e9bf39f13

@ -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

Loading…
Cancel
Save