summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/matcher/signature.lua10
-rw-r--r--server/src/parser/ast.lua4
-rw-r--r--server/src/parser/grammar.lua3
-rw-r--r--server/test/signature/init.lua11
4 files changed, 19 insertions, 9 deletions
diff --git a/server/src/matcher/signature.lua b/server/src/matcher/signature.lua
index 60316a5f..159fde80 100644
--- a/server/src/matcher/signature.lua
+++ b/server/src/matcher/signature.lua
@@ -20,7 +20,7 @@ end
local function findDirtyCall(vm, pos)
local results = {}
for _, call in ipairs(vm.results.calls) do
- if call.args.dirty and isContainPos(call.args, pos) then
+ if isContainPos(call.args, pos) then
local n = findArgCount(call.args, pos)
results[#results+1] = {
func = call.func,
@@ -45,8 +45,12 @@ return function (vm, pos)
end
local hovers = {}
- for i, call in ipairs(calls) do
- hovers[i] = hover(call.var, call.source, nil, call.select)
+ for _, call in ipairs(calls) do
+ hovers[#hovers+1] = hover(call.var, call.source, nil, call.select)
+ end
+
+ if #hovers == 0 then
+ return nil
end
return hovers
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 0b3e369a..45a0cbee 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -119,10 +119,6 @@ local defs = {
}
return obj
end,
- DirtyCall = function (obj)
- obj.dirty = true
- return obj
- end,
Binary = function (...)
local e1, op = ...
if not op then
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index d7464e5b..942c23fc 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -268,8 +268,7 @@ Suffix <- DOT MustName
/ Sp ({} Table {}) -> Call
/ Sp ({} String {}) -> Call
/ BL Exp -> Index BR
- / Sp ({} PL ExpList PR {}) -> Call
- / Sp ({} PL ExpList {}) -> Call -> DirtyCall
+ / Sp ({} PL ExpList PR? {}) -> Call
DirtyExp <- Exp / DirtyName
ExpList <- (COMMA DirtyExp)+
diff --git a/server/test/signature/init.lua b/server/test/signature/init.lua
index 855ffa24..0c343384 100644
--- a/server/test/signature/init.lua
+++ b/server/test/signature/init.lua
@@ -33,3 +33,14 @@ x(@
label = "function x(a: any, b: any)",
arg = 'a: any'
}
+
+TEST [[
+local function x(a, b)
+end
+
+x(@)
+]]
+{
+ label = "function x(a: any, b: any)",
+ arg = 'a: any'
+}