diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-22 20:01:37 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-22 20:01:37 +0800 |
commit | 9fa30f145071d6b7059a017c406649f049c03eee (patch) | |
tree | f9b18bfacd5900ddcbe584c6f5e76148acc0583a | |
parent | 969cc263b08d56be0f293bd9488e92e5ae437adb (diff) | |
download | lua-language-server-9fa30f145071d6b7059a017c406649f049c03eee.zip |
修改限制
-rw-r--r-- | script-beta/await.lua | 12 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 6 |
2 files changed, 17 insertions, 1 deletions
diff --git a/script-beta/await.lua b/script-beta/await.lua index c00e27e0..a26adff8 100644 --- a/script-beta/await.lua +++ b/script-beta/await.lua @@ -9,6 +9,7 @@ m.coMap = setmetatable({}, { __mode = 'k' }) m.idMap = {} m.delayQueue = {} m.delayQueueIndex = 1 +m._enable = true --- 设置错误处理器 ---@param errHandle function {comment = '当有错误发生时,会以错误堆栈为参数调用该函数'} @@ -127,6 +128,9 @@ end --- 延迟 function m.delay() + if not m._enable then + return + end if not coroutine.isyieldable() then return end @@ -169,4 +173,12 @@ function m.setPriority(n) m.coMap[coroutine.running()].priority = true end +function m.enable() + m._enable = true +end + +function m.disable() + m._enable = false +end + return m diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 2e06c7ee..7a4f643c 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1987,13 +1987,17 @@ function m.searchSameFields(status, simple, mode) start = 1, } end - for i = 1, 999 do + local i = 0 + local see = 0 + while see <= 999 do + i = i + 1 local data = queue[i] if not data then return end if not status.lock[data.obj] then status.lock[data.obj] = true + see = see + 1 status.cache.count = status.cache.count + 1 m.checkSameSimple(status, simple, data, mode, status.results, queue) end |