diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-08 00:04:07 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-08 00:04:07 +0800 |
commit | 0e687b98624860a169b4a58813e6e4c38e3783af (patch) | |
tree | 78c22234459179feda17e2ae272f848aac45faa0 /script | |
parent | 735210cb6ba3e4e0689efc3155319b0f195eac8d (diff) | |
download | lua-language-server-0e687b98624860a169b4a58813e6e4c38e3783af.zip |
cleanup
Diffstat (limited to 'script')
-rw-r--r-- | script/parser/guide.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index b22001fc..2bd9066b 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -468,19 +468,27 @@ end function m.getLocal(source, name, pos) local block = source -- find nearest source - while block.start > pos or block.finish < pos do - block = block.parent + for _ = 1, 10000 do if not block then return nil end + if block.start <= pos and block.finish >= pos then + break + end + block = block.parent end + m.eachSourceContain(block, pos, function (src) if blockTypes[src.type] and (src.finish - src.start) < (block.finish - src.start) then block = src end end) - while block do + + for _ = 1, 10000 do + if not block then + break + end local res if block.locals then for _, loc in ipairs(block.locals) do |