diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-26 10:28:18 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-26 10:28:18 +0800 |
commit | e9bb594f37a5f28a984a81211d572c39aa68b728 (patch) | |
tree | ccc99c2be2d39e5d8d6e411a8c10f6d35900a8de | |
parent | 712347eb8a31ae0b8e6cc1c96fd7f75d152f0719 (diff) | |
download | lua-language-server-e9bb594f37a5f28a984a81211d572c39aa68b728.zip |
修正报错
-rw-r--r-- | server/src/matcher/hover.lua | 9 | ||||
-rw-r--r-- | server/test/hover/init.lua | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua index e34bec69..d2e7dd9c 100644 --- a/server/src/matcher/hover.lua +++ b/server/src/matcher/hover.lua @@ -406,7 +406,14 @@ return function (result, source, lsp, select) end local lib, fullKey, oo = findLib(result) - local valueType = lib and lib.type or result.value.type or 'nil' + local valueType = lib and lib.type + if valueType then + if type(valueType) == 'table' then + valueType = valueType[1] + end + else + valueType = result.value.type or 'nil' + end local name = fullKey or buildValueName(result, source) if valueType == 'function' then return getFunctionHover(name, result, source, lib, oo, select) diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index 71e839ae..7a9ebe6f 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -221,3 +221,9 @@ TEST [[ local <?t?> = - 1000 ]] [[number t = -1000]] + +TEST [[ +for <?c?> in io.lines() do +end +]] +[[string c]] |