diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-07-30 13:53:26 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-07-30 13:53:26 +0800 |
commit | 9f701d9a8a2ad3938dd857bc21f25e65209cfe1e (patch) | |
tree | a256afa95a98d00a3d4ec88e5db483ed20fb4c44 /script/core | |
parent | 663432699b44af3365c399b8906d1bdcc7185e07 (diff) | |
download | lua-language-server-9f701d9a8a2ad3938dd857bc21f25e65209cfe1e.zip |
improve cache
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/diagnostics/deprecated.lua | 20 |
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, |