summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-14 16:54:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-14 16:54:13 +0800
commit657c25016e7c76012e21ff0729cd6c3bd6703ee5 (patch)
tree041db8338d795d8f41edd21bf6d03253221ec24e
parent8860d1a77c820e017ee82d6ba9ce2ff2b8d90e8b (diff)
downloadlua-language-server-657c25016e7c76012e21ff0729cd6c3bd6703ee5.zip
修正一个报错
-rw-r--r--server/src/matcher/hover.lua5
-rw-r--r--server/test/hover/init.lua6
2 files changed, 11 insertions, 0 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua
index b4430b02..b997e8f8 100644
--- a/server/src/matcher/hover.lua
+++ b/server/src/matcher/hover.lua
@@ -145,6 +145,11 @@ local function buildValueName(result, source)
end
local parentName = declarat.parentName
+
+ if not parentName then
+ return result.key or ''
+ end
+
if parentName == '?' then
local parentType = result.parentValue and result.parentValue.type
if parentType == 'table' then
diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua
index 45c4d8ed..348b5c8c 100644
--- a/server/test/hover/init.lua
+++ b/server/test/hover/init.lua
@@ -153,3 +153,9 @@ TEST [[
local <?v?> = collectgarbage()
]]
"nil v"
+
+TEST [[
+local <!type!>
+w2l:get_default()[<?type?>]
+]]
+"any type"