summaryrefslogtreecommitdiff
path: root/script-beta/files.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/files.lua')
-rw-r--r--script-beta/files.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/script-beta/files.lua b/script-beta/files.lua
index 3d1a2c90..30dd52b4 100644
--- a/script-beta/files.lua
+++ b/script-beta/files.lua
@@ -5,6 +5,7 @@ local furi = require 'file-uri'
local parser = require 'parser'
local proto = require 'proto'
local lang = require 'language'
+local await = require 'await'
local m = {}
@@ -88,6 +89,7 @@ function m.setText(uri, text)
file.cache = {}
file.version = file.version + 1
m.globalVersion = m.globalVersion + 1
+ await.close('files.version')
m.onWatch('update', originUri)
end
@@ -131,12 +133,14 @@ function m.remove(uri)
m.fileMap[uri] = nil
m.globalVersion = m.globalVersion + 1
+ await.close('files.version')
m.onWatch('remove', originUri)
end
--- 移除所有文件
function m.removeAll()
m.globalVersion = m.globalVersion + 1
+ await.close('files.version')
for uri in pairs(m.fileMap) do
m.fileMap[uri] = nil
m.onWatch('remove', uri)