summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-24 18:19:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-24 18:19:28 +0800
commitb2e64a958248b90d3f16e4ebe4d415f8ae87a454 (patch)
treebe99ff609fc16cf05f1759c8638b6c60363679a9
parent56c5182628423a803a2ebe8565fb2aeca313da95 (diff)
downloadlua-language-server-b2e64a958248b90d3f16e4ebe4d415f8ae87a454.zip
区分2种清空
-rw-r--r--server/src/files/files.lua6
-rw-r--r--server/src/service.lua14
2 files changed, 8 insertions, 12 deletions
diff --git a/server/src/files/files.lua b/server/src/files/files.lua
index 31e5e21b..ed56483c 100644
--- a/server/src/files/files.lua
+++ b/server/src/files/files.lua
@@ -86,6 +86,12 @@ function mt:clear()
self._library = {}
end
+function mt:clearVM()
+ for _, f in pairs(self._files) do
+ f:removeVM()
+ end
+end
+
function mt:eachFile()
return pairs(self._files)
end
diff --git a/server/src/service.lua b/server/src/service.lua
index 16c1f549..d88753f1 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -312,13 +312,7 @@ function mt:reCompile()
end
local compiled = {}
- local needCompile = {}
- for uri in self._files:eachFile() do
- needCompile[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
@@ -332,11 +326,7 @@ function mt:reCompile()
self.globalValue = nil
self._compileTask:remove()
self._needCompile = {}
- for uri, buf in self._files:eachOpened() do
- self:readText(uri, uric.decode(uri), buf, compiled)
- self:needCompile(uri, compiled)
- end
- for uri in pairs(needCompile) do
+ for uri in self._files:eachFile() do
self:needCompile(uri, compiled)
end