summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md3
-rw-r--r--script/core/diagnostics/missing-parameter.lua2
-rw-r--r--test/diagnostics/common.lua14
3 files changed, 17 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 848a00f1..bc16e3b7 100644
--- a/changelog.md
+++ b/changelog.md
@@ -9,8 +9,9 @@
if x == -- suggest `CONST.X` and `CONST.Y` here
```
* `FIX` with clients that support LSP 3.17 (VSCode), workspace diagnostics are triggered every time when opening a file.
+* `FIX` [#1204](https://github.com/sumneko/lua-language-server/issues/1204)
-## 3.2.5
+## 3.2.51204
`2022-6-9`
* `NEW` provide config docs in `LUA_LANGUAGE_SERVER/doc/`
* `FIX` [#1148](https://github.com/sumneko/lua-language-server/issues/1148)
diff --git a/script/core/diagnostics/missing-parameter.lua b/script/core/diagnostics/missing-parameter.lua
index f69afa79..a475673f 100644
--- a/script/core/diagnostics/missing-parameter.lua
+++ b/script/core/diagnostics/missing-parameter.lua
@@ -64,7 +64,7 @@ local function countCallArgs(source)
return math.huge
end
if lastArg.type == 'call' then
- result = result + countMaxReturns(lastArg) - 1
+ result = result + countMaxReturns(lastArg.node) - 1
end
result = result + #source.args
return result
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua
index 74cd09f3..f41102ed 100644
--- a/test/diagnostics/common.lua
+++ b/test/diagnostics/common.lua
@@ -1579,3 +1579,17 @@ end
x()
]]
+
+TEST [[
+---@meta
+
+---@param x fun()
+local function f1(x)
+end
+
+---@return fun()
+local function f2()
+end
+
+f1(f2())
+]]