diff --git a/changelog.md b/changelog.md index 2ebb2f9ea..fe0417d77 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ ## 2.0.3 * `CHG` improve memory usage * `FIX` some dialog boxes block the initialization process +* `FIX` diagnostics `undefined-field`: blocks main thread * `FIX` [#565](https://github.com/sumneko/lua-language-server/issues/565) ## 2.0.2 diff --git a/script/core/diagnostics/deprecated.lua b/script/core/diagnostics/deprecated.lua index 282058455..d6265f645 100644 --- a/script/core/diagnostics/deprecated.lua +++ b/script/core/diagnostics/deprecated.lua @@ -35,8 +35,6 @@ return function (uri, callback) end end - await.delay() - local id = noder.getID(src) if not id then return @@ -46,6 +44,8 @@ return function (uri, callback) return end + await.delay() + if not vm.isDeprecated(src, true) then cache[id] = true return diff --git a/script/core/diagnostics/undefined-field.lua b/script/core/diagnostics/undefined-field.lua index fd1fdbd9a..8dad36eb8 100644 --- a/script/core/diagnostics/undefined-field.lua +++ b/script/core/diagnostics/undefined-field.lua @@ -3,6 +3,7 @@ local vm = require 'vm' local lang = require 'language' local guide = require 'parser.guide' local noder = require 'core.noder' +local await = require 'await' local SkipCheckClass = { ['unknown'] = true, @@ -27,6 +28,9 @@ return function (uri, callback) if cache[id] then return end + + await.delay() + if #vm.getDefs(src) > 0 then cache[id] = true return