summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/unbalanced-assignments.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-30 01:33:39 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-30 01:33:39 +0800
commit457990e081a84b0aec2448ad23a00f5b95f1e457 (patch)
tree128ac285c1f1d41304e9ee282da59eb3b5fd3609 /script/core/diagnostics/unbalanced-assignments.lua
parentb09404bb037f50e5fdba9eecfe0e55c9e12faa6f (diff)
downloadlua-language-server-457990e081a84b0aec2448ad23a00f5b95f1e457.zip
add many delays in diagnostics
Diffstat (limited to 'script/core/diagnostics/unbalanced-assignments.lua')
-rw-r--r--script/core/diagnostics/unbalanced-assignments.lua22
1 files changed, 14 insertions, 8 deletions
diff --git a/script/core/diagnostics/unbalanced-assignments.lua b/script/core/diagnostics/unbalanced-assignments.lua
index df71f0c9..c21ca993 100644
--- a/script/core/diagnostics/unbalanced-assignments.lua
+++ b/script/core/diagnostics/unbalanced-assignments.lua
@@ -2,7 +2,17 @@ local files = require 'files'
local define = require 'proto.define'
local lang = require 'language'
local guide = require 'parser.guide'
+local await = require 'await'
+local types = {
+ 'local',
+ 'setlocal',
+ 'setglobal',
+ 'setfield',
+ 'setindex' ,
+}
+
+---@async
return function (uri, callback, code)
local ast = files.getState(uri)
if not ast then
@@ -31,13 +41,9 @@ return function (uri, callback, code)
end
end
- guide.eachSource(ast.ast, function (source)
- if source.type == 'local'
- or source.type == 'setlocal'
- or source.type == 'setglobal'
- or source.type == 'setfield'
- or source.type == 'setindex' then
- checkSet(source)
- end
+ ---@async
+ guide.eachSourceTypes(ast.ast, types, function (source)
+ await.delay()
+ checkSet(source)
end)
end