blob: c3b701be298194136c17df3454a6d02b32f578cc (
plain)
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
38
39
40
41
42
43
44
|
local rpc = require 'rpc'
local config = require 'config'
local EXISTS = {}
local function eq(a, b)
if a == EXISTS and b ~= nil then
return true
end
local tp1, tp2 = type(a), type(b)
if tp1 ~= tp2 then
return false
end
if tp1 == 'table' then
local mark = {}
for k in pairs(a) do
if not eq(a[k], b[k]) then
return false
end
mark[k] = true
end
for k in pairs(b) do
if not mark[k] then
return false
end
end
return true
end
return a == b
end
return function (lsp)
-- 请求配置
rpc:request('workspace/configuration', {
items = {
{
section = 'Lua',
},
},
}, function (configs)
config:setConfig(configs[1])
lsp:reCompile()
end)
end
|