summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-30 13:53:26 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-30 13:53:26 +0800
commit9f701d9a8a2ad3938dd857bc21f25e65209cfe1e (patch)
treea256afa95a98d00a3d4ec88e5db483ed20fb4c44 /script/core
parent663432699b44af3365c399b8906d1bdcc7185e07 (diff)
downloadlua-language-server-9f701d9a8a2ad3938dd857bc21f25e65209cfe1e.zip
improve cache
Diffstat (limited to 'script/core')
-rw-r--r--script/core/diagnostics/deprecated.lua20
1 files changed, 18 insertions, 2 deletions
diff --git a/script/core/diagnostics/deprecated.lua b/script/core/diagnostics/deprecated.lua
index 12b5ddce..0aeac9e9 100644
--- a/script/core/diagnostics/deprecated.lua
+++ b/script/core/diagnostics/deprecated.lua
@@ -35,14 +35,24 @@ return function (uri, callback)
return
end
- if cache[id] then
+ if cache[id] == false then
return
end
+ if cache[id] then
+ callback {
+ start = src.start,
+ finish = src.finish,
+ tags = { define.DiagnosticTag.Deprecated },
+ message = cache[id].message,
+ data = cache[id].data,
+ }
+ end
+
await.delay()
if not vm.isDeprecated(src, true) then
- cache[id] = true
+ cache[id] = false
return
end
@@ -75,6 +85,12 @@ return function (uri, callback)
message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(versions, '/'), config.get 'Lua.runtime.version'))
end
end
+ cache[id] = {
+ message = message,
+ data = {
+ versions = versions,
+ },
+ }
callback {
start = src.start,