summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-24 11:42:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-24 11:42:54 +0800
commit859bf22a7d50473ae796f9a33a15de413cf0604c (patch)
treeabd74bd92c2f2be892808c761429b9315100b864 /server
parentbc56c859f3f15e4b626d65c317ae077f551288ad (diff)
downloadlua-language-server-859bf22a7d50473ae796f9a33a15de413cf0604c.zip
修正bug
Diffstat (limited to 'server')
-rw-r--r--server/src/files/files.lua14
-rw-r--r--server/src/service.lua8
-rw-r--r--server/src/task.lua1
3 files changed, 7 insertions, 16 deletions
diff --git a/server/src/files/files.lua b/server/src/files/files.lua
index cf619381..4d420739 100644
--- a/server/src/files/files.lua
+++ b/server/src/files/files.lua
@@ -67,19 +67,9 @@ function mt:get(uri)
return self._files[uri]
end
----@param uri uri
----@param vm VM
-function mt:saveVM(uri, vm)
- local f = self._files[uri]
- if not f then
- return
- end
- f:saveVM(vm)
-end
-
-function mt:clear()
+function mt:clearVM()
for _, f in pairs(self._files) do
- f:remove()
+ f:removeVM()
end
end
diff --git a/server/src/service.lua b/server/src/service.lua
index 1d60f22d..8ba9cd3b 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -286,7 +286,7 @@ function mt:reCompile()
reload[uri] = true
end
- self._files:clear()
+ self._files:clearVM()
for _, obj in pairs(listMgr.list) do
if obj.type == 'source' or obj.type == 'function' then
@@ -299,6 +299,7 @@ function mt:reCompile()
self.emmy = emmyMgr()
self.globalValue = nil
self._compileTask:remove()
+ --self._compileTask = nil
self._needCompile = {}
local compiled = {}
local n = 0
@@ -323,7 +324,7 @@ function mt:clearAllFiles()
for uri in self._files:eachFile() do
self:clearDiagnostics(uri)
end
- self._files:clear()
+ self._files:clearVM()
end
---@param uri uri
@@ -483,7 +484,7 @@ function mt:compileVM(uri)
end
return nil
end
- file:saveVM(vm, os.clock() - clock, version)
+ file:saveVM(vm, version, os.clock() - clock)
local clock = os.clock()
local lines = parser:lines(file:getText(), 'utf8')
@@ -899,6 +900,7 @@ function mt:_testFindDeadValues()
pop()
end
scan('root', self._files)
+ log.debug('Finish...')
end
function mt:onTick()
diff --git a/server/src/task.lua b/server/src/task.lua
index a1ed37de..88db7a28 100644
--- a/server/src/task.lua
+++ b/server/src/task.lua
@@ -56,7 +56,6 @@ end
return function (callback)
local self = setmetatable({
- callback = callback,
data = {},
task = coroutine.create(callback),
}, mt)