diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-21 17:42:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-21 17:42:39 +0800 |
commit | 11cf0b1af0706a3fc94a1c303272ec3ba3344af7 (patch) | |
tree | 6cf98a3a0bca8a4cb63a524543a12ec5d5a78efd /server | |
parent | fdbc2738d8a79aaf76ba2177b9144295886e39b8 (diff) | |
download | lua-language-server-11cf0b1af0706a3fc94a1c303272ec3ba3344af7.zip |
修正一些问题
Diffstat (limited to 'server')
-rw-r--r-- | server/src/matcher/find_lib.lua | 3 | ||||
-rw-r--r-- | server/src/matcher/signature.lua | 17 | ||||
-rw-r--r-- | server/src/method/textDocument/signatureHelp.lua | 2 |
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 |