summaryrefslogtreecommitdiff
path: root/script/method
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-07-01 14:22:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-07-01 14:22:57 +0800
commit0e758e813745d51ffffd0056e360e2892e5c80b0 (patch)
treecd931002dcd85845713e7e323c1f3538f5e38210 /script/method
parent85e12909c541c00b5947db5f91dbbba903d8339c (diff)
downloadlua-language-server-0e758e813745d51ffffd0056e360e2892e5c80b0.zip
fix #183 修复无工作目录时没有初始化的问题
Diffstat (limited to 'script/method')
-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',
}
},