summaryrefslogtreecommitdiff
path: root/server/src/core/hover
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-26 19:54:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-26 19:54:57 +0800
commit07b47b134c45a2528644bd6a481b8e46b691fdfc (patch)
tree3317304a7c82b553306cbe8fe8a9e5151426ac7a /server/src/core/hover
parent6fb028ef9e053076170ed03e46b9a4ab5d248e0c (diff)
downloadlua-language-server-07b47b134c45a2528644bd6a481b8e46b691fdfc.zip
赋值操作也支持EmmyComment
Diffstat (limited to 'server/src/core/hover')
-rw-r--r--server/src/core/hover/hover.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/server/src/core/hover/hover.lua b/server/src/core/hover/hover.lua
index 25a1bc3b..d78b8add 100644
--- a/server/src/core/hover/hover.lua
+++ b/server/src/core/hover/hover.lua
@@ -191,15 +191,17 @@ local function getValueHover(source, name, value, lib)
valueType = '*' .. valueType
end
- local tip
+ local tips = {}
local literal
if lib then
literal = lib.code or (lib.value and formatLiteral(lib.value))
- tip = lib.description
+ tips[#tips+1] = lib.description
else
literal = value:getLiteral() and formatLiteral(value:getLiteral())
end
+ tips[#tips+1] = value:getComment()
+
local tp
if source:bindLocal() then
tp = 'local'
@@ -214,14 +216,7 @@ local function getValueHover(source, name, value, lib)
end
end
end
- local comment = loc:getComment()
- if comment then
- if tip then
- tip = tip .. '\n\n-------------\n\n' .. comment
- else
- tip = comment
- end
- end
+ tips[#tips+1] = loc:getComment()
elseif source:get 'global' then
tp = 'global'
elseif source:get 'simple' then
@@ -249,6 +244,11 @@ local function getValueHover(source, name, value, lib)
text = ('%s %s: %s = %s'):format(tp, name, valueType, literal)
end
end
+
+ local tip
+ if #tips > 0 then
+ tip = table.concat(tips, '\n\n-------------\n\n')
+ end
return {
label = text,
description = tip,