summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-22 17:07:19 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-22 17:07:19 +0800
commit73d85a0172ba551e82487cf62c9565ecd4f2753f (patch)
tree22bbd1995b01728ba8dd504e3121d78940186d06 /server/src
parentf6cf28b71d81785a29a163a82427a9276744793e (diff)
downloadlua-language-server-73d85a0172ba551e82487cf62c9565ecd4f2753f.zip
需要调整一下初始化的顺序
Diffstat (limited to 'server/src')
-rw-r--r--server/src/method/initialized.lua27
1 files changed, 15 insertions, 12 deletions
diff --git a/server/src/method/initialized.lua b/server/src/method/initialized.lua
index 3ee4a965..fd5cd617 100644
--- a/server/src/method/initialized.lua
+++ b/server/src/method/initialized.lua
@@ -2,7 +2,7 @@ local rpc = require 'rpc'
local workspace = require 'workspace'
local config = require 'config'
-return function (lsp)
+local function initAfterConfig(lsp)
-- 请求工作目录
rpc:request('workspace/workspaceFolders', nil, function (folders)
if folders then
@@ -13,17 +13,6 @@ return function (lsp)
end
end
end)
- -- 请求配置
- rpc:request('workspace/configuration', {
- items = {
- {
- section = 'Lua',
- },
- },
- }, function (configs)
- config:setConfig(configs[1])
- lsp:reCompile()
- end)
-- 必须动态注册的事件:
rpc:request('client/registerCapability', {
registrations = {
@@ -49,5 +38,19 @@ return function (lsp)
}, function ()
log.debug('client/registerCapability Success!')
end)
+end
+
+return function (lsp)
+ -- 请求配置
+ rpc:request('workspace/configuration', {
+ items = {
+ {
+ section = 'Lua',
+ },
+ },
+ }, function (configs)
+ config:setConfig(configs[1])
+ initAfterConfig(lsp)
+ end)
return true
end