summaryrefslogtreecommitdiff
path: root/script-beta/workspace/workspace.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/workspace/workspace.lua')
-rw-r--r--script-beta/workspace/workspace.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/script-beta/workspace/workspace.lua b/script-beta/workspace/workspace.lua
index deee764a..f24f825a 100644
--- a/script-beta/workspace/workspace.lua
+++ b/script-beta/workspace/workspace.lua
@@ -12,6 +12,7 @@ local m = {}
m.type = 'workspace'
m.ignoreVersion = -1
m.ignoreMatcher = nil
+m.preloadVersion = 0
m.uri = ''
m.path = ''
@@ -133,7 +134,9 @@ function m.awaitPreload()
if read >= max then
break
end
- await.sleep(0.1)
+ await.sleep(0.1, function ()
+ return m.preloadVersion
+ end)
end
log.info('Preload finish.')
@@ -193,4 +196,12 @@ function m.getRelativePath(uri)
return fs.relative(fs.path(path), fs.path(m.path)):string()
end
+function m.reload()
+ m.preloadVersion = m.preloadVersion + 1
+ files.removeAll()
+ await.create(function ()
+ m.awaitPreload()
+ end)
+end
+
return m