diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-16 21:20:52 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-16 21:20:52 +0800 |
commit | 755ecb36a18ed32d2409597441e590f68774e7d8 (patch) | |
tree | b187fd8ee6e80c2acc135ba1c9730b603007ee3a /script-beta | |
parent | fbac27b0a2ffd7ee82c37f70bde7f69ba2e2cdae (diff) | |
download | lua-language-server-755ecb36a18ed32d2409597441e590f68774e7d8.zip |
修改infer
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/parser/guide.lua | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 925ee9ab..06e6949c 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -3725,18 +3725,35 @@ function m.inferByPCallReturn(status, source) end function m.cleanInfers(infers) - local mark = {} + local hasDoc for i = 1, #infers do local infer = infers[i] - if not infer then - return + if infer.source.type == 'doc.class' + or infer.source.type == 'doc.type.name' then + hasDoc = true end - local key = ('%s|%p'):format(infer.type, infer.source) - if mark[key] then - infers[i] = infers[#infers] - infers[#infers] = nil - else - mark[key] = true + end + if hasDoc then + for i = #infers, 1, -1 do + local infer = infers[i] + if infer.source.type == 'doc.class' + or infer.source.type == 'doc.type.name' then + else + infers[i] = infers[#infers] + infers[#infers] = nil + end + end + else + local mark = {} + for i = #infers, 1, -1 do + local infer = infers[i] + local key = ('%s|%p'):format(infer.type, infer.source) + if mark[key] then + infers[i] = infers[#infers] + infers[#infers] = nil + else + mark[key] = true + end end end end |