summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-03 19:33:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-03 19:33:16 +0800
commit86da1325d469b45a62c84cde26634855b44cb4d3 (patch)
tree6eb7f60f7b2fd9fa4680b8a6b2ab7486bec3ca31 /script/files.lua
parent74478473d38bbe4809d1e2bc4f82376085a65153 (diff)
downloadlua-language-server-86da1325d469b45a62c84cde26634855b44cb4d3.zip
resolve #746
Diffstat (limited to 'script/files.lua')
-rw-r--r--script/files.lua7
1 files changed, 4 insertions, 3 deletions
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')