forked from jose-elias-alvarez/null-ls.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
37 lines (32 loc) · 971 Bytes
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
local logger = require("null-ls.logger")
local export_tables = {
diagnostics = {},
formatting = {},
code_actions = {},
hover = {},
completion = {},
_test = {},
}
for method, table in pairs(export_tables) do
setmetatable(table, {
__index = function(t, k)
local ok, builtin = pcall(require, string.format("null-ls.builtins.%s.%s", method, k))
if not ok then
logger:warn(
string.format("failed to load builtin %s for method %s; please check your config", k, method)
)
return
end
rawset(t, k, builtin)
return builtin
end,
})
end
return setmetatable(export_tables, {
__index = function(t, k)
if not rawget(t, k) then
logger:warn(string.format("failed to load builtin table for method %s; please check your config", k))
end
return rawget(t, k)
end,
})