summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
Diffstat (limited to 'script/core')
-rw-r--r--script/core/diagnostics/assign-type-mismatch.lua3
-rw-r--r--script/core/diagnostics/need-check-nil.lua3
-rw-r--r--script/core/diagnostics/redundant-value.lua3
-rw-r--r--script/core/diagnostics/trailing-space.lua3
-rw-r--r--script/core/diagnostics/unbalanced-assignments.lua3
5 files changed, 10 insertions, 5 deletions
diff --git a/script/core/diagnostics/assign-type-mismatch.lua b/script/core/diagnostics/assign-type-mismatch.lua
index 8472e87c..6fa26553 100644
--- a/script/core/diagnostics/assign-type-mismatch.lua
+++ b/script/core/diagnostics/assign-type-mismatch.lua
@@ -52,13 +52,14 @@ return function (uri, callback)
return
end
+ local delayer = await.newThrottledDelayer(15)
---@async
guide.eachSourceTypes(state.ast, checkTypes, function (source)
local value = source.value
if not value then
return
end
- await.delay()
+ delayer:delay()
if source.type == 'setlocal' then
local locNode = vm.compileNode(source.node)
if not locNode.hasDefined then
diff --git a/script/core/diagnostics/need-check-nil.lua b/script/core/diagnostics/need-check-nil.lua
index 9c86939a..fe72d4ba 100644
--- a/script/core/diagnostics/need-check-nil.lua
+++ b/script/core/diagnostics/need-check-nil.lua
@@ -11,9 +11,10 @@ return function (uri, callback)
return
end
+ local delayer = await.newThrottledDelayer(500)
---@async
guide.eachSourceType(state.ast, 'getlocal', function (src)
- await.delay()
+ delayer:delay()
local checkNil
local nxt = src.next
if nxt then
diff --git a/script/core/diagnostics/redundant-value.lua b/script/core/diagnostics/redundant-value.lua
index 6f60303b..ceb090c9 100644
--- a/script/core/diagnostics/redundant-value.lua
+++ b/script/core/diagnostics/redundant-value.lua
@@ -11,8 +11,9 @@ return function (uri, callback)
return
end
+ local delayer = await.newThrottledDelayer(50000)
guide.eachSource(state.ast, function (src) ---@async
- await.delay()
+ delayer:delay()
if src.redundant then
callback {
start = src.start,
diff --git a/script/core/diagnostics/trailing-space.lua b/script/core/diagnostics/trailing-space.lua
index 2e0398b2..1fdccf80 100644
--- a/script/core/diagnostics/trailing-space.lua
+++ b/script/core/diagnostics/trailing-space.lua
@@ -10,9 +10,10 @@ return function (uri, callback)
if not state or not text then
return
end
+ local delayer = await.newThrottledDelayer(5000)
local lines = state.lines
for i = 0, #lines do
- await.delay()
+ delayer:delay()
local startOffset = lines[i]
local finishOffset = text:find('[\r\n]', startOffset) or (#text + 1)
local lastOffset = finishOffset - 1
diff --git a/script/core/diagnostics/unbalanced-assignments.lua b/script/core/diagnostics/unbalanced-assignments.lua
index c21ca993..f72e1fd5 100644
--- a/script/core/diagnostics/unbalanced-assignments.lua
+++ b/script/core/diagnostics/unbalanced-assignments.lua
@@ -41,9 +41,10 @@ return function (uri, callback, code)
end
end
+ local delayer = await.newThrottledDelayer(1000)
---@async
guide.eachSourceTypes(ast.ast, types, function (source)
- await.delay()
+ delayer:delay()
checkSet(source)
end)
end