diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-07-29 21:14:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-07-29 21:14:00 +0800 |
commit | 663432699b44af3365c399b8906d1bdcc7185e07 (patch) | |
tree | 32329135c1b767a0edb4c07f92623ca45ff964ef | |
parent | 18febae579f4b9f185fac73f2fec2dc006b94558 (diff) | |
download | lua-language-server-663432699b44af3365c399b8906d1bdcc7185e07.zip |
improve
-rw-r--r-- | script/core/diagnostics/deprecated.lua | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/script/core/diagnostics/deprecated.lua b/script/core/diagnostics/deprecated.lua index 22bf70c0..12b5ddce 100644 --- a/script/core/diagnostics/deprecated.lua +++ b/script/core/diagnostics/deprecated.lua @@ -7,6 +7,7 @@ local define = require 'proto.define' local await = require 'await' local noder = require 'core.noder' +local types = {'getglobal', 'getfield', 'getindex', 'getmethod'} return function (uri, callback) local ast = files.getState(uri) if not ast then @@ -15,13 +16,7 @@ return function (uri, callback) local cache = {} - guide.eachSource(ast.ast, function (src) - if src.type ~= 'getglobal' - and src.type ~= 'getfield' - and src.type ~= 'getindex' - and src.type ~= 'getmethod' then - return - end + guide.eachSourceTypes(ast.ast, types, function (src) if src.type == 'getglobal' then local key = src[1] if not key then @@ -51,6 +46,8 @@ return function (uri, callback) return end + await.delay() + local defs = vm.getDefs(src) local validVersions for _, def in ipairs(defs) do |