Skip to content

Commit 54a488b

Browse files
committed
fix #1204 missing-parameter incorrect
should count returns by `call.node` instead of `call`
1 parent 3e48646 commit 54a488b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Diff for: changelog.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
if x == -- suggest `CONST.X` and `CONST.Y` here
1010
```
1111
* `FIX` with clients that support LSP 3.17 (VSCode), workspace diagnostics are triggered every time when opening a file.
12+
* `FIX` [#1204](https://github.com/sumneko/lua-language-server/issues/1204)
1213

13-
## 3.2.5
14+
## 3.2.51204
1415
`2022-6-9`
1516
* `NEW` provide config docs in `LUA_LANGUAGE_SERVER/doc/`
1617
* `FIX` [#1148](https://github.com/sumneko/lua-language-server/issues/1148)

Diff for: script/core/diagnostics/missing-parameter.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ local function countCallArgs(source)
6464
return math.huge
6565
end
6666
if lastArg.type == 'call' then
67-
result = result + countMaxReturns(lastArg) - 1
67+
result = result + countMaxReturns(lastArg.node) - 1
6868
end
6969
result = result + #source.args
7070
return result

Diff for: test/diagnostics/common.lua

+14
Original file line numberDiff line numberDiff line change
@@ -1579,3 +1579,17 @@ end
15791579
15801580
x()
15811581
]]
1582+
1583+
TEST [[
1584+
---@meta
1585+
1586+
---@param x fun()
1587+
local function f1(x)
1588+
end
1589+
1590+
---@return fun()
1591+
local function f2()
1592+
end
1593+
1594+
f1(f2())
1595+
]]

0 commit comments

Comments
 (0)