summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-03 20:01:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-03 20:01:41 +0800
commit2e22590dc8fe124a4429ec25954fb757648e8c24 (patch)
tree392d58aa57bc80617d2d55e0de14b5a2ecbfcc44
parent25d3e051095ff1f1b7da58e591b2455a25d19328 (diff)
downloadlua-language-server-2e22590dc8fe124a4429ec25954fb757648e8c24.zip
fix
-rw-r--r--script/files.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/script/files.lua b/script/files.lua
index 37aef7e1..29e32c01 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -69,7 +69,6 @@ function m.open(uri)
cache = {},
}
m.onWatch('open', uri)
- m.addRef(uri)
end
--- 关闭文件
@@ -81,7 +80,9 @@ function m.close(uri)
file.trusted = false
end
m.onWatch('close', uri)
- m.delRef(uri)
+ if (file._ref or 0) <= 0 and not file.isOpen(uri) then
+ m.remove(uri)
+ end
end
--- 是否打开
@@ -380,7 +381,7 @@ function m.delRef(uri)
end
file._ref = (file._ref or 0) - 1
log.debug('del ref', uri)
- if file._ref <= 0 then
+ if file._ref <= 0 and not m.isOpen(uri) then
m.remove(uri)
end
end