From 86da1325d469b45a62c84cde26634855b44cb4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 3 Nov 2021 19:33:16 +0800 Subject: resolve #746 --- script/files.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'script/files.lua') diff --git a/script/files.lua b/script/files.lua index 9b22ea41..eca3d58d 100644 --- a/script/files.lua +++ b/script/files.lua @@ -120,7 +120,9 @@ end --- 设置文件文本 ---@param uri uri ---@param text string -function m.setText(uri, text, isTrust) +---@param isTrust boolean +---@param version integer +function m.setText(uri, text, isTrust, version) if not text then return end @@ -134,7 +136,6 @@ function m.setText(uri, text, isTrust) if not m.fileMap[uri] then m.fileMap[uri] = { uri = uri, - version = 0, } m.fileCount = m.fileCount + 1 create = true @@ -159,7 +160,7 @@ function m.setText(uri, text, isTrust) m.astMap[uri] = nil file.cache = {} file.cacheActiveTime = math.huge - file.version = file.version + 1 + file.version = version m.globalVersion = m.globalVersion + 1 await.close('files.version') m.onWatch('version') -- cgit v1.2.3