summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-13 18:22:50 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-13 18:22:50 +0800
commit564451b82ccb973a8a20a88794318db47b0c0a3b (patch)
tree2d5eed2161e8b1eaaed80a4fb0dec314e06e52fc /server/src
parent9ae9210c5250d3f53a358fd04ac5a947ac244963 (diff)
downloadlua-language-server-564451b82ccb973a8a20a88794318db47b0c0a3b.zip
把source测试挪到service里
Diffstat (limited to 'server/src')
-rw-r--r--server/src/service.lua11
-rw-r--r--server/src/vm/vm.lua14
2 files changed, 14 insertions, 11 deletions
diff --git a/server/src/service.lua b/server/src/service.lua
index ba45f9f4..8b07aa33 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -561,6 +561,17 @@ function mt:onTick()
alive,
dead
))
+
+ --TODO source测试
+ local total = 0
+ local alive = 0
+ for source in pairs(CachedSource) do
+ if not source:isDead() then
+ alive = alive + 1
+ end
+ total = total + 1
+ end
+ log.debug(('CachedSource: %d/%d'):format(alive, total))
end
end
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua
index 000d0284..4a0250f1 100644
--- a/server/src/vm/vm.lua
+++ b/server/src/vm/vm.lua
@@ -8,7 +8,8 @@ local buildGlobal = require 'vm.global'
local createMulti = require 'vm.multi'
local libraryBuilder = require 'vm.library'
-local CachedSource = setmetatable({}, { __mode = 'kv' })
+-- TODO source测试
+rawset(_G, 'CachedSource', setmetatable({}, { __mode = 'kv' }))
local mt = {}
mt.__index = mt
@@ -1080,7 +1081,7 @@ function mt:instantSource(source)
if sourceMgr.instant(source) then
source:setUri(self:getUri())
self.sources[#self.sources+1] = source
- --CachedSource[source] = true
+ CachedSource[source] = true
end
return source
end
@@ -1186,14 +1187,5 @@ return function (ast, lsp, uri)
if not suc then
return nil, res
end
- --local total = 0
- --local alive = 0
- --for source in pairs(CachedSource) do
- -- if not source:isDead() then
- -- alive = alive + 1
- -- end
- -- total = total + 1
- --end
- --log.debug(('CachedSource: %d/%d'):format(alive, total))
return res
end