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
|
local rpc = require 'rpc'
--- @param lsp LSP
--- @param params table
return function (lsp, params)
local event = params.event
for _, removed in ipairs(event.removed) do
lsp:removeWorkspace(removed.name, removed.uri)
end
for _, added in ipairs(event.added) do
lsp:addWorkspace(added.name, added.uri)
end
local ws = lsp.workspaces[1]
if ws then
-- 请求工作目录
local uri = ws.uri
-- 请求配置
rpc:request('workspace/configuration', {
items = {
{
scopeUri = uri,
section = 'Lua',
},
{
scopeUri = uri,
section = 'files.associations',
},
{
scopeUri = uri,
section = 'files.exclude',
}
},
}, function (configs)
lsp:onUpdateConfig(configs[1], {
associations = configs[2],
exclude = configs[3],
})
end)
end
end
|