summaryrefslogtreecommitdiff
path: root/script/method/workspace/didChangeConfiguration.lua
blob: eca61ebc2050203d1c95061db965b194a767eb1a (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
local rpc = require 'rpc'

--- @param lsp LSP
return function (lsp)
    for _, ws in ipairs(lsp.workspaces) do
        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