diff options
Diffstat (limited to 'script/workspace/workspace.lua')
-rw-r--r-- | script/workspace/workspace.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 94b1d9e5..76dbd195 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -402,14 +402,27 @@ function m.getCache(name) end function m.reload() + await.call(m.awaitReload) +end + +function m.awaitReload() local rpath = require 'workspace.require-path' local plugin = require 'plugin' + m.ready = false files.flushAllLibrary() files.removeAllClosed() files.flushCache() rpath.flush() plugin.init() - await.call(m.awaitPreload) + m.awaitPreload() + m.ready = true +end + +---等待工作目录加载完成 +function m.awaitReady() + while not m.ready do + await.sleep(0.1) + end end files.watch(function (ev, uri) |