diff options
| author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-11-24 23:01:07 -0500 |
|---|---|---|
| committer | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-11-25 23:46:21 -0500 |
| commit | 6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e (patch) | |
| tree | 7f2bf25ca5456b23304295dba8fe0005e85a5c10 /lua/lspconfig.lua | |
| parent | fix: only set cmd_cwd if filepath exists (#1485) (diff) | |
| download | nvim-lspconfig-6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e.tar nvim-lspconfig-6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e.tar.gz nvim-lspconfig-6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e.tar.bz2 nvim-lspconfig-6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e.tar.lz nvim-lspconfig-6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e.tar.xz nvim-lspconfig-6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e.tar.zst nvim-lspconfig-6c2fb86c6a03e20abea5ddd17d735885f0b7cb5e.zip | |
feat: expose configs
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 |
