diff options
Diffstat (limited to 'server/src/method/initialized.lua')
-rw-r--r-- | server/src/method/initialized.lua | 27 |
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 |