summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-26 10:28:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-26 10:28:18 +0800
commite9bb594f37a5f28a984a81211d572c39aa68b728 (patch)
treeccc99c2be2d39e5d8d6e411a8c10f6d35900a8de
parent712347eb8a31ae0b8e6cc1c96fd7f75d152f0719 (diff)
downloadlua-language-server-e9bb594f37a5f28a984a81211d572c39aa68b728.zip
修正报错
-rw-r--r--server/src/matcher/hover.lua9
-rw-r--r--server/test/hover/init.lua6
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]]