summaryrefslogtreecommitdiff
path: root/script/method/initialized.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/method/initialized.lua')
-rw-r--r--script/method/initialized.lua34
1 files changed, 28 insertions, 6 deletions
diff --git a/script/method/initialized.lua b/script/method/initialized.lua
index ee1cbfc4..a3cf44c7 100644
--- a/script/method/initialized.lua
+++ b/script/method/initialized.lua
@@ -3,22 +3,44 @@ local rpc = require 'rpc'
--- @param lsp LSP
--- @return boolean
return function (lsp)
- for _, ws in ipairs(lsp.workspaces) do
- -- 请求工作目录
- local uri = ws.uri
+ if #lsp.workspaces > 0 then
+ 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
+ else
-- 请求配置
rpc:request('workspace/configuration', {
items = {
{
- scopeUri = uri,
section = 'Lua',
},
{
- scopeUri = uri,
section = 'files.associations',
},
{
- scopeUri = uri,
section = 'files.exclude',
}
},