summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-22 16:34:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-22 16:34:59 +0800
commit5df9959be4a51ab567743b72753f15a24b8f7ef6 (patch)
tree238a4e2563425453231edbd2348ceda2233c7167 /server
parentd40edfa5955d4901c971c1ec53248afbaf0cc6e8 (diff)
downloadlua-language-server-5df9959be4a51ab567743b72753f15a24b8f7ef6.zip
把所有文件都加载进来
Diffstat (limited to 'server')
-rw-r--r--server/src/async/async.lua2
-rw-r--r--server/src/service.lua4
-rw-r--r--server/src/workspace.lua1
3 files changed, 6 insertions, 1 deletions
diff --git a/server/src/async/async.lua b/server/src/async/async.lua
index b381ae11..953cf5cf 100644
--- a/server/src/async/async.lua
+++ b/server/src/async/async.lua
@@ -78,7 +78,7 @@ local function callback(id, running)
end
-- TODO 封装成对象
local suc, destroy = xpcall(running.callback, log.error, result)
- if suc and destroy then
+ if not suc or destroy then
RunningList[id] = nil
IdlePool[#IdlePool+1] = running.task
break
diff --git a/server/src/service.lua b/server/src/service.lua
index cd1572e9..37cb048e 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -156,6 +156,7 @@ function mt:readText(uri, path)
end
local text = io.load(path)
if not text then
+ log.debug('无法找到文件:', path)
return
end
self._file[uri] = {
@@ -175,9 +176,12 @@ end
function mt:reCompile()
local compiled = {}
+ local n = 0
for uri in pairs(self._file) do
self:needCompile(uri, compiled)
+ n = n + 1
end
+ log.debug('reCompile:', n)
if self._needShowComplete then
self._needShowComplete = nil
diff --git a/server/src/workspace.lua b/server/src/workspace.lua
index 2b74ad6d..283b4951 100644
--- a/server/src/workspace.lua
+++ b/server/src/workspace.lua
@@ -99,6 +99,7 @@ function mt:init(rootUri)
if ok then
local uri = self:uriEncode(path)
self.files[name] = uri
+ self.lsp:readText(uri, path)
end
end
self:reset()