diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-05-27 14:44:34 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-05-27 14:44:34 +0800 |
commit | ed764615146751a0a9a0d9169a84b9fb9f5248e9 (patch) | |
tree | 28424abce891830fee63c49ac9b679b0e069415d /script/parser/luadoc.lua | |
parent | 2474d6a76bd84c2816c4f458d36089c0ea96158c (diff) | |
download | lua-language-server-ed764615146751a0a9a0d9169a84b9fb9f5248e9.zip |
cleanup
Diffstat (limited to 'script/parser/luadoc.lua')
-rw-r--r-- | script/parser/luadoc.lua | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 85215140..6f35052b 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -1114,17 +1114,25 @@ local function bindDocsBetween(sources, binded, bindSources, start, finish) end local src = sources[index] if src.start < start then - left = index + left = index + 1 else right = index end end - for i = index - 1, max do + + -- 从前往后进行绑定 + for i = index, max do local src = sources[i] if src then if src.start > finish then break end + -- 遇到table后中断,处理以下情况: + -- ---@type AAA + -- local t = {x = 1, y = 2} + if src.type == 'table' then + break + end if src.start >= start then src.bindDocs = binded bindSources[#bindSources+1] = src @@ -1220,13 +1228,10 @@ local function bindDocs(state) or src.type == 'tablefield' or src.type == 'tableindex' or src.type == 'function' + or src.type == 'table' or src.type == '...' then sources[#sources+1] = src end - if src.type == 'table' then - -- TODO - return true - end end) table.sort(sources, function (a, b) return a.start < b.start |