summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-25 10:05:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-25 10:05:34 +0800
commit21e3a0f6e980293a72c6ba9d70b408d6dc6a43ff (patch)
tree7f8758af69d5343018b69db1c273ebe9f2476521 /server/src
parentfffac853964beebbfc1c335984193798a205fb67 (diff)
downloadlua-language-server-21e3a0f6e980293a72c6ba9d70b408d6dc6a43ff.zip
允许提前跳出编译
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()