mirror of
https://github.com/neovim/nvim-lspconfig.git
synced 2026-01-10 15:21:34 +01:00
* switch to lua api for autocommands * switch to nvim_create_user_command * move to lua plugin initialization NOTICE: Defining commands in server configurations will be deprecated in future releases. See `:help lspconfig.txt` to setup the same in an `on_attach` function. Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
30 lines
741 B
Lua
30 lines
741 B
Lua
local configs = require 'lspconfig.configs'
|
|
|
|
local M = {
|
|
util = require 'lspconfig.util',
|
|
}
|
|
|
|
local mt = {}
|
|
function mt:__index(k)
|
|
if configs[k] == nil then
|
|
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
|
|
end
|
|
return configs[k]
|
|
end
|
|
|
|
return setmetatable(M, mt)
|