summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/hover/arg.lua5
-rw-r--r--script/core/signature.lua2
-rw-r--r--script/parser/newparser.lua1
-rw-r--r--test/completion/common.lua9
-rw-r--r--test/hover/init.lua4
-rw-r--r--test/signature/init.lua2
6 files changed, 16 insertions, 7 deletions
diff --git a/script/core/hover/arg.lua b/script/core/hover/arg.lua
index 5963ad97..4e6a1ace 100644
--- a/script/core/hover/arg.lua
+++ b/script/core/hover/arg.lua
@@ -38,7 +38,10 @@ local function asFunction(source, oop)
infer.searchAndViewInfers(arg)
)
elseif arg.type == '...' then
- args[#args+1] = '...'
+ args[#args+1] = ('%s: %s'):format(
+ '...',
+ infer.searchAndViewInfers(arg)
+ )
else
args[#args+1] = ('%s'):format(infer.searchAndViewInfers(arg))
end
diff --git a/script/core/signature.lua b/script/core/signature.lua
index 57483718..d55866f5 100644
--- a/script/core/signature.lua
+++ b/script/core/signature.lua
@@ -66,7 +66,7 @@ local function makeOneSignature(source, oop, index)
if index > i and i > 0 then
local lastLabel = params[i].label
local text = label:sub(lastLabel[1] + 1, lastLabel[2])
- if text == '...' then
+ if text:sub(1, 3) == '...' then
index = i
end
end
diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua
index 0b721a7a..cee6d499 100644
--- a/script/parser/newparser.lua
+++ b/script/parser/newparser.lua
@@ -2094,6 +2094,7 @@ local function parseParams(params)
start = getPosition(Tokens[Index], 'left'),
finish = getPosition(Tokens[Index] + 2, 'right'),
parent = params,
+ [1] = '...',
}
local chunk = Chunk[#Chunk]
chunk.vararg = vararg
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 73c6d7e6..15e2cc2a 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -1334,12 +1334,13 @@ end
]]
{
{
- label = 'a, b, c',
+ label = 'a, b, c, ...',
kind = define.CompletionItemKind.Snippet,
insertText = [[
a ${1:any}
---@param b ${2:any}
----@param c ${3:any}]],
+---@param c ${3:any}
+---@param ... ${4:any}]],
},
{
label = 'self',
@@ -1357,6 +1358,10 @@ a ${1:any}
label = 'c',
kind = define.CompletionItemKind.Interface,
},
+ {
+ label = '...',
+ kind = define.CompletionItemKind.Interface,
+ },
}
TEST [[
diff --git a/test/hover/init.lua b/test/hover/init.lua
index d5c47ddf..974e0740 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -245,7 +245,7 @@ TEST [[
<?print?>()
]]
[[
-function print(...)
+function print(...: any)
]]
TEST [[
@@ -299,7 +299,7 @@ end
<?x?>(1, 2, 3, 4, 5, 6, 7)
]]
[[
-function x(a: any, ...)
+function x(a: any, ...: any)
]]
TEST [[
diff --git a/test/signature/init.lua b/test/signature/init.lua
index 8bc53f02..aa9d9094 100644
--- a/test/signature/init.lua
+++ b/test/signature/init.lua
@@ -83,7 +83,7 @@ end
x(1, 2, 3, <??>
]]
-'function x(a: any, <!...!>)'
+'function x(a: any, <!...: any!>)'
TEST [[
(''):sub(<??>