summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-08-05 20:08:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-08-05 20:08:30 +0800
commit68e33bf512598a92e8b4432f32603c89b5cacf3a (patch)
tree2b2c82d7eadf2e534e0d1d5fb85dd91faf3938c7
parente62acf2d322d509c7e9adba1e6aad7d0ba1d613f (diff)
downloadlua-language-server-68e33bf512598a92e8b4432f32603c89b5cacf3a.zip
修正emmy function type以OOP的形式调用时,hover第一个参数提示不正确的问题
-rw-r--r--server/src/core/hover/emmy_function.lua3
-rw-r--r--server/test/hover/init.lua11
2 files changed, 14 insertions, 0 deletions
diff --git a/server/src/core/hover/emmy_function.lua b/server/src/core/hover/emmy_function.lua
index 4dd89107..8c36ea2c 100644
--- a/server/src/core/hover/emmy_function.lua
+++ b/server/src/core/hover/emmy_function.lua
@@ -10,6 +10,9 @@ local function buildEmmyArgs(emmy, object, select)
local i = 0
emmy:eachParam(function (name, typeObj)
i = i + 1
+ if i < start then
+ return
+ end
if i > start then
strs[#strs+1] = ', '
end
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index a3d56cdf..88bc13d5 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -779,6 +779,17 @@ function ()
]]
TEST [[
+---@type fun(a:any, b:any)
+local f
+local t = {f = f}
+t:<?f?>()
+]]
+[[
+function f(b: any)
+ -> any
+]]
+
+TEST [[
---@param names string[]
local function f(<?names?>)
end