diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-06-24 17:47:16 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-06-24 17:47:16 +0800 |
commit | 2d242061f9ff6e9be0d6800fc9f542b3078844df (patch) | |
tree | 3d8238d30ce69b5756f8a0ea9b30f18614511e7c /server | |
parent | 0719ce507d89b318405f98872db7689a2ea6097f (diff) | |
download | lua-language-server-2d242061f9ff6e9be0d6800fc9f542b3078844df.zip |
整理代码
Diffstat (limited to 'server')
-rw-r--r-- | server/src/service.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/server/src/service.lua b/server/src/service.lua index 2d31ad9e..16c1f549 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -311,8 +311,15 @@ function mt:reCompile() self.emmy:remove() end + local compiled = {} + local needCompile = {} + for uri in self._files:eachFile() do + needCompile[uri] = true + end + self._files:clear() + for _, obj in pairs(listMgr.list) do if obj.type == 'source' or obj.type == 'function' then obj:kill() @@ -325,9 +332,12 @@ function mt:reCompile() self.globalValue = nil self._compileTask:remove() self._needCompile = {} - local compiled = {} 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 + self:needCompile(uri, compiled) end self:_testMemory('skip') |