diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-28 20:55:00 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-28 20:55:00 +0800 |
commit | ef4df9c2b854808e2fa1280e383c5e4213d66a28 (patch) | |
tree | 1fe7b8dbe7d63d24140f2438e6d14fca8299d89e /server | |
parent | 72787989fa47f50589aa025f52df0a05f0692043 (diff) | |
download | lua-language-server-ef4df9c2b854808e2fa1280e383c5e4213d66a28.zip |
重新编译时终止当前编译
Diffstat (limited to 'server')
-rw-r--r-- | server/src/service.lua | 3 | ||||
-rw-r--r-- | server/src/vm/function.lua | 12 | ||||
-rw-r--r-- | server/src/vm/vm.lua | 5 |
3 files changed, 9 insertions, 11 deletions
diff --git a/server/src/service.lua b/server/src/service.lua index bc13e31c..bc8ca141 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -285,6 +285,7 @@ function mt:reCompile() self.chain = chainMgr() self.emmy = emmyMgr() self.globalValue = nil + self._compileTask = nil self._needCompile = {} @@ -630,7 +631,7 @@ function mt:_doCompileTask() if not self._compileTask then return end - while true do + while self._compileTask do local suc, res = coroutine.resume(self._compileTask) if not suc then self._compileTask = nil diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua index b6a8ae87..4c2f0be5 100644 --- a/server/src/vm/function.lua +++ b/server/src/vm/function.lua @@ -78,11 +78,7 @@ function mt:loadLocal(name) local locals = self.locals[i] local loc = locals[name] if loc then - if loc:getSource() then - return loc - else - locals[name] = nil - end + return loc end if self.chunk[i] then break @@ -90,11 +86,7 @@ function mt:loadLocal(name) end local uv = self.upvalues[name] if uv then - if uv:getSource() then - return uv - else - self.upvalues[name] = nil - end + return uv end return nil end diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index 56fec644..d1c05f36 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -1018,9 +1018,14 @@ function mt:doAction(action) if coroutine.isyieldable() then if self.lsp:isNeedCompile(self.uri) then coroutine.yield() + if self._removed then + coroutine.yield('stop') + return + end else self:remove() coroutine.yield('stop') + return end end local tp = action.type |