summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/core/signature.lua9
-rw-r--r--server/test/signature/init.lua22
2 files changed, 30 insertions, 1 deletions
diff --git a/server/src/core/signature.lua b/server/src/core/signature.lua
index 8e4e9f8f..63c343eb 100644
--- a/server/src/core/signature.lua
+++ b/server/src/core/signature.lua
@@ -7,9 +7,16 @@ local function isContainPos(obj, pos)
return false
end
+local function isContainArgPos(obj, pos)
+ if obj.start <= pos and obj.finish+1 >= pos then
+ return true
+ end
+ return false
+end
+
local function findArgCount(args, pos)
for i, arg in ipairs(args) do
- if isContainPos(arg, pos) then
+ if isContainArgPos(arg, pos) then
return i, arg
end
end
diff --git a/server/test/signature/init.lua b/server/test/signature/init.lua
index 4110c585..0f16af91 100644
--- a/server/test/signature/init.lua
+++ b/server/test/signature/init.lua
@@ -49,6 +49,28 @@ x(@)
}
TEST [[
+local function x(a, b)
+end
+
+x(xxx@)
+]]
+{
+ label = "function x(a: any, b: any)",
+ arg = 'a: any'
+}
+
+TEST [[
+local function x(a, b)
+end
+
+x(xxx, @)
+]]
+{
+ label = "function x(a: any, b: any)",
+ arg = 'b: any'
+}
+
+TEST [[
function mt:f(a)
end