summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/matcher/find_lib.lua3
-rw-r--r--server/src/matcher/signature.lua17
-rw-r--r--server/src/method/textDocument/signatureHelp.lua2
3 files changed, 13 insertions, 9 deletions
diff --git a/server/src/matcher/find_lib.lua b/server/src/matcher/find_lib.lua
index e4ea6e02..c4d5bff3 100644
--- a/server/src/matcher/find_lib.lua
+++ b/server/src/matcher/find_lib.lua
@@ -1,4 +1,7 @@
local function findLib(var)
+ if var.type ~= 'local' and var.type ~= 'field' then
+ return nil
+ end
local value = var.value
local lib = value.lib
if not lib then
diff --git a/server/src/matcher/signature.lua b/server/src/matcher/signature.lua
index 96694047..c62117fc 100644
--- a/server/src/matcher/signature.lua
+++ b/server/src/matcher/signature.lua
@@ -25,13 +25,16 @@ local function findCall(vm, pos)
if arg and arg.type == 'string' then
return nil
end
- results[#results+1] = {
- func = call.func,
- var = vm.results.sources[call.lastObj],
- source = call.lastObj,
- select = n,
- args = call.args,
- }
+ local var = vm.results.sources[call.lastObj]
+ if var then
+ results[#results+1] = {
+ func = call.func,
+ var = var,
+ source = call.lastObj,
+ select = n,
+ args = call.args,
+ }
+ end
end
end
-- 可能处于 'func1(func2(' 的嵌套中,因此距离越远的函数层级越低
diff --git a/server/src/method/textDocument/signatureHelp.lua b/server/src/method/textDocument/signatureHelp.lua
index 763e7a15..7620b542 100644
--- a/server/src/method/textDocument/signatureHelp.lua
+++ b/server/src/method/textDocument/signatureHelp.lua
@@ -34,7 +34,5 @@ return function (lsp, params)
activeSignature = #signatures - 1,
}
- log.debug(table.dump(response))
-
return response
end