summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/matcher/diagnostics.lua3
-rw-r--r--server/src/matcher/hover.lua25
-rw-r--r--server/src/matcher/vm.lua2
-rw-r--r--server/test/hover/init.lua10
4 files changed, 32 insertions, 8 deletions
diff --git a/server/src/matcher/diagnostics.lua b/server/src/matcher/diagnostics.lua
index e7dfb533..7a190354 100644
--- a/server/src/matcher/diagnostics.lua
+++ b/server/src/matcher/diagnostics.lua
@@ -137,6 +137,9 @@ end
local function searchRedundantParameters(results, callback)
for _, call in ipairs(results.calls) do
+ if not call.func.built then
+ goto NEXT_CALL
+ end
if call.func.hasDots then
goto NEXT_CALL
end
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua
index 41dccd39..911cf964 100644
--- a/server/src/matcher/hover.lua
+++ b/server/src/matcher/hover.lua
@@ -209,11 +209,7 @@ local function buildValueArgs(result, source)
local values = {}
if func.args then
for i, arg in ipairs(func.args) do
- if arg.type == '...' then
- names[i] = '...'
- else
- names[i] = arg.key
- end
+ names[i] = arg.key
end
end
if func.argValues then
@@ -226,10 +222,23 @@ local function buildValueArgs(result, source)
if source.object then
start = 2
end
- for i = start, math.max(#names, #values) do
- local name = names[i] or '?'
+ local max
+ if func.built then
+ max = #names
+ else
+ max = math.max(#names, #values)
+ end
+ for i = start, max do
+ local name = names[i]
local value = values[i] or 'any'
- strs[#strs+1] = name .. ': ' .. value
+ if name then
+ strs[#strs+1] = name .. ': ' .. value
+ else
+ strs[#strs+1] = value
+ end
+ end
+ if func.hasDots then
+ strs[#strs+1] = '...'
end
return table.concat(strs, ', ')
end
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index aade0f92..0633934d 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -253,6 +253,8 @@ function mt:buildFunction(exp, object)
return func
end
+ func.built = true
+
self.scope:push()
self.chunk:push()
self.chunk:cut 'dots'
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index 0321a952..a11dff45 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -181,3 +181,13 @@ function string.lower(string)
-> string
Returns a copy of this string with all uppercase letters changed to lowercase.
]]
+
+TEST [[
+local function x(a, ...)
+end
+
+<?x?>(1, 2, 3, 4, 5, 6, 7)
+]]
+[[
+function x(a: number, ...)
+]]