File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 66* ` FIX ` [ #1217 ] ( https://github.com/sumneko/lua-language-server/issues/1217 )
77* ` FIX ` [ #1218 ] ( https://github.com/sumneko/lua-language-server/issues/1218 )
88* ` FIX ` [ #1220 ] ( https://github.com/sumneko/lua-language-server/issues/1220 )
9+ * ` FIX ` [ #1223 ] ( https://github.com/sumneko/lua-language-server/issues/1223 )
910
1011## 3.3.0
1112` 2022-6-15 `
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ local lang = require 'language'
55
66--- @param source parser.object
77--- @return integer
8- local function countReturns (source )
8+ local function countReturnsOfFunction (source )
99 local n = 0
1010
1111 local docs = source .bindDocs
@@ -33,14 +33,25 @@ local function countReturns(source)
3333 return n
3434end
3535
36+ --- @param source parser.object
37+ --- @return integer
38+ local function countReturnsOfDocFunction (source )
39+ return # source .returns
40+ end
41+
3642local function countMaxReturns (source )
3743 local hasFounded
3844 local n = 0
3945 for _ , def in ipairs (vm .getDefs (source )) do
40- if def .type == ' doc.type.function'
41- or def .type == ' function' then
46+ if def .type == ' function' then
47+ hasFounded = true
48+ local rets = countReturnsOfFunction (def )
49+ if rets > n then
50+ n = rets
51+ end
52+ elseif def .type == ' doc.type.function' then
4253 hasFounded = true
43- local rets = countReturns (def )
54+ local rets = countReturnsOfDocFunction (def )
4455 if rets > n then
4556 n = rets
4657 end
Original file line number Diff line number Diff line change @@ -1601,3 +1601,15 @@ end
16011601
16021602f1(f2())
16031603]]
1604+
1605+ TEST [[
1606+ ---@meta
1607+
1608+ ---@type fun():integer
1609+ local f
1610+
1611+ ---@param x integer
1612+ local function foo(x) end
1613+
1614+ foo(f())
1615+ ]]
You can’t perform that action at this time.
0 commit comments