summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authoractboy168 <actboy168@gmail.com>2020-12-03 14:15:41 +0800
committeractboy168 <actboy168@gmail.com>2020-12-03 14:15:41 +0800
commitd481a5a6a103a057830d62a5d4afa04f0cab3a1e (patch)
tree19476dc413a58e49e55b9c3fe36d5f8ada299957 /script
parentc08d501b7bdea16d87998d3ef28c2b708515cd10 (diff)
downloadlua-language-server-d481a5a6a103a057830d62a5d4afa04f0cab3a1e.zip
增加若干测试
Diffstat (limited to 'script')
-rw-r--r--script/core/hover/description.lua21
1 files changed, 12 insertions, 9 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index 7be50947..74896709 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -210,22 +210,25 @@ local function getFunctionComment(source)
)
end
elseif doc.type == 'doc.return' then
- if has_return_comment and doc.comment then
+ if has_return_comment then
local name = {}
for _, rtn in ipairs(doc.returns) do
if rtn.name then
name[#name+1] = rtn.name[1]
end
end
- if #name == 0 then
- comments[#comments+1] = ('@*return* — %s'):format(
- doc.comment.text
- )
+ if doc.comment then
+ if #name == 0 then
+ comments[#comments+1] = ('@*return* — %s'):format(doc.comment.text)
+ else
+ comments[#comments+1] = ('@*return* `%s` — %s'):format(table.concat(name, ','), doc.comment.text)
+ end
else
- comments[#comments+1] = ('@*return* `%s` — %s'):format(
- table.concat(name, ','),
- doc.comment.text
- )
+ if #name == 0 then
+ comments[#comments+1] = '@*return*'
+ else
+ comments[#comments+1] = ('@*return* `%s`'):format(table.concat(name, ','))
+ end
end
end
end