summaryrefslogtreecommitdiff
path: root/server/src/core/hover.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-28 17:04:56 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-28 17:04:56 +0800
commitb684462e3e1722454baf80f756c3b3a81c390053 (patch)
tree35b9987664ddcc8b00d05ceae3f15bb236d4f275 /server/src/core/hover.lua
parentdbfb79aac5139fce6ac00821a07534dd742fe6ed (diff)
downloadlua-language-server-b684462e3e1722454baf80f756c3b3a81c390053.zip
修正bug
Diffstat (limited to 'server/src/core/hover.lua')
-rw-r--r--server/src/core/hover.lua19
1 files changed, 15 insertions, 4 deletions
diff --git a/server/src/core/hover.lua b/server/src/core/hover.lua
index 7ee8c5bf..dbe9a21d 100644
--- a/server/src/core/hover.lua
+++ b/server/src/core/hover.lua
@@ -346,7 +346,13 @@ local function getStringHover(result, lsp)
}
end
-return function (result, source, lsp, select)
+local function hoverAsValue(result, source, lsp, select)
+ if result:getType() == 'string' then
+ return getStringHover(result, lsp)
+ end
+end
+
+local function hoverAsVar(result, source, lsp, select)
if not result.value then
return
end
@@ -355,9 +361,6 @@ return function (result, source, lsp, select)
return
end
- if result.type == 'string' then
- return getStringHover(result, lsp)
- end
if result.type ~= 'local' and result.type ~= 'field' then
return
@@ -389,3 +392,11 @@ return function (result, source, lsp, select)
hover.name = name
return hover
end
+
+return function (result, source, lsp, select)
+ if result.type == 'value' then
+ return hoverAsValue(result, source, lsp, select)
+ else
+ return hoverAsVar(result, source, lsp, select)
+ end
+end