diff options
Diffstat (limited to 'lua/lspconfig.lua')
| -rw-r--r-- | lua/lspconfig.lua | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lua/lspconfig.lua b/lua/lspconfig.lua index 2e7f848c..e6db7361 100644 --- a/lua/lspconfig.lua +++ b/lua/lspconfig.lua @@ -4,8 +4,6 @@ local M = { util = require 'lspconfig/util', } -local script_path = M.util.script_path() - M._root = {} function M.available_servers() @@ -72,9 +70,21 @@ end local mt = {} function mt:__index(k) if configs[k] == nil then - -- dofile is used here as a performance hack to increase the speed of calls to setup({}) - -- dofile does not cache module lookups, and requires the absolute path to the target file - pcall(dofile, script_path .. 'lspconfig/' .. k .. '.lua') + local success, config = pcall(require, 'lspconfig.server_configurations.' .. k) + if success then + configs[k] = config + else + vim.notify( + string.format( + '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 end return configs[k] end |
