diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-26 16:02:37 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-26 16:02:37 +0800 |
commit | e70ac18efc00ae438615650f6727693e93830217 (patch) | |
tree | 28cb59225e39edcbc78e56c6adb9f4017345c4da /script-beta | |
parent | 202d4199114b283abe3f38a63c3d845dd183ce11 (diff) | |
download | lua-language-server-e70ac18efc00ae438615650f6727693e93830217.zip |
根据函数的 doc.return 分析类型
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/parser/guide.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 90566865..992fd239 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -3123,7 +3123,32 @@ local function mergeLibraryFunctionReturns(status, source, index) end end +local function mergeFunctionReturnsByDoc(status, source, index) + if not source.bindDocs then + return + end + local returns = {} + for _, doc in ipairs(source.bindDocs) do + if doc.type == 'doc.return' then + for _, rtn in ipairs(doc.returns) do + returns[#returns+1] = rtn + end + end + end + local rtn = returns[index] + if not rtn then + return + end + local results = m.getDocTypeNames(rtn) + for _, res in ipairs(results) do + status.results[#status.results+1] = res + end +end + local function mergeFunctionReturns(status, source, index) + if mergeFunctionReturnsByDoc(status, source, index) then + return + end local returns = source.returns if not returns then return |