2022-03-20 10:22:32 +08:00
|
|
|
local configs = require 'lspconfig.configs'
|
2021-10-05 15:13:10 +08:00
|
|
|
|
|
|
|
local M = {
|
2022-03-20 10:22:32 +08:00
|
|
|
util = require 'lspconfig.util',
|
2021-10-05 15:13:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function M.available_servers()
|
2022-09-10 19:50:22 +08:00
|
|
|
vim.deprecate('lspconfig.available_servers', 'lspconfig.util.available_servers', '0.1.4', 'lspconfig')
|
|
|
|
return M.util.available_servers()
|
2021-10-05 15:13:10 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
local mt = {}
|
|
|
|
function mt:__index(k)
|
|
|
|
if configs[k] == nil then
|
2022-03-20 10:22:32 +08:00
|
|
|
local success, config = pcall(require, 'lspconfig.server_configurations.' .. k)
|
|
|
|
if success then
|
|
|
|
configs[k] = config
|
|
|
|
else
|
|
|
|
vim.notify(
|
|
|
|
string.format(
|
|
|
|
'[lspconfig] Cannot access configuration for %s. Ensure this server is listed in '
|
|
|
|
.. '`server_configurations.md` or added as a custom server.',
|
|
|
|
k
|
|
|
|
),
|
|
|
|
vim.log.levels.WARN
|
|
|
|
)
|
|
|
|
-- Return a dummy function for compatibility with user configs
|
|
|
|
return { setup = function() end }
|
|
|
|
end
|
2021-10-05 15:13:10 +08:00
|
|
|
end
|
|
|
|
return configs[k]
|
|
|
|
end
|
|
|
|
|
|
|
|
return setmetatable(M, mt)
|