summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/await.lua3
-rw-r--r--script-beta/workspace/workspace.lua10
2 files changed, 11 insertions, 2 deletions
diff --git a/script-beta/await.lua b/script-beta/await.lua
index a26adff8..a718dbb6 100644
--- a/script-beta/await.lua
+++ b/script-beta/await.lua
@@ -100,6 +100,9 @@ function m.sleep(time)
end
local co = coroutine.running()
timer.wait(time, function ()
+ if coroutine.status(co) == 'dead' then
+ return
+ end
return m.checkResult(co, coroutine.resume(co))
end)
return coroutine.yield()
diff --git a/script-beta/workspace/workspace.lua b/script-beta/workspace/workspace.lua
index d2a0637f..e75e280f 100644
--- a/script-beta/workspace/workspace.lua
+++ b/script-beta/workspace/workspace.lua
@@ -159,6 +159,8 @@ function m.awaitPreload()
if not m.uri then
return
end
+ await.close 'preload'
+ await.setID 'preload'
local progress = {
max = 0,
read = 0,
@@ -186,6 +188,11 @@ function m.awaitPreload()
await.sleep(0.1)
end
+ --for i = 1, 100 do
+ -- await.sleep(0.1)
+ -- log.info('sleep', i)
+ --end
+
log.info('Preload finish.')
local diagnostic = require 'provider.diagnostic'
@@ -262,8 +269,7 @@ end
function m.reload()
files.removeAll()
rpath.flush()
- await.close 'preload'
- await.call(m.awaitPreload, 'preload')
+ await.call(m.awaitPreload)
end
files.watch(function (ev, uri)