summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/vm.lua6
-rw-r--r--server/src/service.lua11
2 files changed, 15 insertions, 2 deletions
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()