From 21e3a0f6e980293a72c6ba9d70b408d6dc6a43ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 25 Jan 2019 10:05:34 +0800 Subject: =?UTF-8?q?=E5=85=81=E8=AE=B8=E6=8F=90=E5=89=8D=E8=B7=B3=E5=87=BA?= =?UTF-8?q?=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/vm.lua | 6 +++++- server/src/service.lua | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'server/src') diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index 965a0bec..79381876 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -1459,7 +1459,11 @@ function mt:doActions(actions) for _, action in ipairs(actions) do self:doAction(action) if coroutine.isyieldable() then - coroutine.yield() + if self.lsp:isNeedCompile(self.uri) then + coroutine.yield() + else + coroutine.yield('stop') + end end end end diff --git a/server/src/service.lua b/server/src/service.lua index 59996733..0eb62121 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -122,6 +122,10 @@ function mt:needCompile(uri, compiled) table.insert(self._needCompile, 1, uri) end +function mt:isNeedCompile(uri) + return self._needCompile[uri] +end + function mt:isWaitingCompile() if self._needCompile[1] then return true @@ -467,7 +471,12 @@ function mt:_doCompileTask() while true do local suc, res = coroutine.resume(self._compileTask) if not suc then - break + self._compileTask = nil + return + end + if res == 'stop' then + self._compileTask = nil + return end if coroutine.status(self._compileTask) == 'suspended' then self:_loadProto() -- cgit v1.2.3