summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-27 17:42:04 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-27 17:42:04 +0800
commitcae348536cef3f2f5f96c5821c7e45539aeff1cf (patch)
tree68066cb4b581712e2db7ca854dcda844f4a82267
parentcda1ac766c662440f23c1fd4a896a268abcf91ff (diff)
downloadlua-language-server-cae348536cef3f2f5f96c5821c7e45539aeff1cf.zip
fix
-rw-r--r--script/core/hint.lua11
1 files changed, 4 insertions, 7 deletions
diff --git a/script/core/hint.lua b/script/core/hint.lua
index 7434796e..767e531e 100644
--- a/script/core/hint.lua
+++ b/script/core/hint.lua
@@ -286,17 +286,15 @@ local function semicolonHint(uri, results, start, finish)
local subber = substr(state)
---@async
guide.eachSourceTypes(state.ast, blockTypes, function (src)
+ await.delay()
for i = 1, #src - 1 do
local current = src[i]
local next = src[i+1]
- local left = current.range or current.finish
+ local left = current.finish
local right = next.start
- if left > right then
- goto CONTINUE
- end
local text = subber(left, right)
if mode == 'All' then
- if not text:find(';', 1, true) then
+ if not text:find '[,;]' then
results[#results+1] = {
text = ';',
offset = left,
@@ -305,7 +303,7 @@ local function semicolonHint(uri, results, start, finish)
}
end
elseif mode == 'SameLine' then
- if not text:find('[;\r\n]') then
+ if not text:find '[,;\r\n]' then
results[#results+1] = {
text = ';',
offset = left,
@@ -314,7 +312,6 @@ local function semicolonHint(uri, results, start, finish)
}
end
end
- ::CONTINUE::
end
if mode == 'All' then
local last = src[#src]