diff options
Diffstat (limited to 'script-beta/files.lua')
-rw-r--r-- | script-beta/files.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/script-beta/files.lua b/script-beta/files.lua index 6f4d1ce9..873d859e 100644 --- a/script-beta/files.lua +++ b/script-beta/files.lua @@ -182,6 +182,21 @@ function m.removeAll() --m.notifyCache = {} end +--- 移除所有关闭的文件 +function m.removeAllClosed() + m.globalVersion = m.globalVersion + 1 + await.close('files.version') + for uri in pairs(m.fileMap) do + if not m.openMap[uri] then + m.fileMap[uri] = nil + m.astMap[uri] = nil + m.linesMap[uri] = nil + m.onWatch('remove', uri) + end + end + --m.notifyCache = {} +end + --- 遍历文件 function m.eachFile() return pairs(m.fileMap) |