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 6
6
* ` FIX ` [ #1217 ] ( https://github.com/sumneko/lua-language-server/issues/1217 )
7
7
* ` FIX ` [ #1218 ] ( https://github.com/sumneko/lua-language-server/issues/1218 )
8
8
* ` FIX ` [ #1220 ] ( https://github.com/sumneko/lua-language-server/issues/1220 )
9
+ * ` FIX ` [ #1223 ] ( https://github.com/sumneko/lua-language-server/issues/1223 )
9
10
10
11
## 3.3.0
11
12
` 2022-6-15 `
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ local lang = require 'language'
5
5
6
6
--- @param source parser.object
7
7
--- @return integer
8
- local function countReturns (source )
8
+ local function countReturnsOfFunction (source )
9
9
local n = 0
10
10
11
11
local docs = source .bindDocs
@@ -33,14 +33,25 @@ local function countReturns(source)
33
33
return n
34
34
end
35
35
36
+ --- @param source parser.object
37
+ --- @return integer
38
+ local function countReturnsOfDocFunction (source )
39
+ return # source .returns
40
+ end
41
+
36
42
local function countMaxReturns (source )
37
43
local hasFounded
38
44
local n = 0
39
45
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
42
53
hasFounded = true
43
- local rets = countReturns (def )
54
+ local rets = countReturnsOfDocFunction (def )
44
55
if rets > n then
45
56
n = rets
46
57
end
Original file line number Diff line number Diff line change @@ -1601,3 +1601,15 @@ end
1601
1601
1602
1602
f1(f2())
1603
1603
]]
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