Skip to content

Commit fe121d0

Browse files
committed
fix #1103
1 parent e7b0b8a commit fe121d0

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* `CHG` parse `.luarc.json` as jsonc. In order to please the editor, it also supports `.luarc.jsonc` as the file name.
55
* `CHG` dose not load files in symbol links
66
* `FIX` diagnostic: send empty results to every file after startup
7+
* `FIX` [#1103](https://github.com/sumneko/lua-language-server/issues/1103)
78

89
## 3.2.2
910
`2022-4-26`

script/core/diagnostics/missing-parameter.lua

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ local function countFuncArgs(source)
2121
for i = #source.args, 1, -1 do
2222
local arg = source.args[i]
2323
if arg.type ~= '...'
24+
and not (arg.name and arg.name[1] =='...')
2425
and not vm.compileNode(arg):isNullable() then
2526
return i
2627
end

script/core/diagnostics/redundant-parameter.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ local function countFuncArgs(source)
1616
if not source.args or #source.args == 0 then
1717
return 0
1818
end
19-
if source.args[#source.args].type == '...' then
19+
local lastArg = source.args[#source.args]
20+
if lastArg.type == '...'
21+
or (lastArg.name and lastArg.name[1] == '...') then
2022
return math.maxinteger
2123
else
2224
return #source.args

test/diagnostics/common.lua

+6
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ end
217217
x(1, 2, 3, 4, 5)
218218
]]
219219

220+
TEST [[
221+
---@type fun(a, b, ...)
222+
local x
223+
x(1, 2, 3, 4, 5)
224+
]]
225+
220226
TEST [[
221227
local m = {}
222228
function m:x(a, b)

0 commit comments

Comments
 (0)