From 73d85a0172ba551e82487cf62c9565ecd4f2753f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 22 Jan 2019 17:07:19 +0800 Subject: =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=B0=83=E6=95=B4=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/method/initialized.lua | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'server/src') 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 -- cgit v1.2.3