summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/core/hover/function.lua14
-rw-r--r--server/src/emmy/param.lua8
-rw-r--r--server/test/hover/init.lua10
3 files changed, 27 insertions, 5 deletions
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua
index aa6816b5..e792485b 100644
--- a/server/src/core/hover/function.lua
+++ b/server/src/core/hover/function.lua
@@ -4,16 +4,20 @@ local function buildValueArgs(func, object, select)
end
local names = {}
local values = {}
- if func.args then
- for _, arg in ipairs(func.args) do
- names[#names+1] = arg:getName()
- end
- end
if func.argValues then
for i, value in ipairs(func.argValues) do
values[i] = value:getType()
end
end
+ if func.args then
+ for i, arg in ipairs(func.args) do
+ names[#names+1] = arg:getName()
+ local param = func:findEmmyParamByName(arg:getName())
+ if param then
+ values[i] = param:getType()
+ end
+ end
+ end
local strs = {}
local start = 1
if object then
diff --git a/server/src/emmy/param.lua b/server/src/emmy/param.lua
index 5894e28e..290ab6e4 100644
--- a/server/src/emmy/param.lua
+++ b/server/src/emmy/param.lua
@@ -9,6 +9,14 @@ function mt:getName()
return self.name
end
+function mt:getType()
+ if self._bindType then
+ return self._bindType:getType()
+ else
+ return 'any'
+ end
+end
+
function mt:getSource()
return listMgr.get(self.source)
end
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index f31dfa03..dfd6dc78 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -623,6 +623,16 @@ local r: number
]]
TEST [[
+---@param x number
+---@param y boolean
+local function <?f?>(x, y)
+end
+]]
+[[
+function f(x: number, y: boolean)
+]]
+
+TEST [[
---@vararg Class
local function f(...)
local _, <?x?> = ...