summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-07-15 09:44:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-07-15 09:44:25 +0800
commit2b06194b9447fab098258d642df2623910355d39 (patch)
tree11efdbfd018d3ae2a2f20846e12c6d2c9bfafdb1 /server/src
parenta0b866db543e1b0822772f534f0facc624d1b65b (diff)
downloadlua-language-server-2b06194b9447fab098258d642df2623910355d39.zip
支持参数描述
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/hover/function.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua
index 5adeeb7e..6139bd1b 100644
--- a/server/src/core/hover/function.lua
+++ b/server/src/core/hover/function.lua
@@ -184,7 +184,22 @@ local function getComment(func)
if not func then
return nil
end
- return func:getComment()
+ local comments = {}
+ local params = func:getEmmyParams()
+ if params then
+ for _, param in ipairs(params) do
+ local option = param:getOption()
+ if option and option.comment then
+ comments[#comments+1] = ('+ `%s`*(%s)*: %s'):format(param:getName(), param:getType(), option.comment)
+ end
+ end
+ end
+ comments[#comments+1] = '\n'
+ comments[#comments+1] = func:getComment()
+ if #comments == 0 then
+ return nil
+ end
+ return table.concat(comments, '\n')
end
local function getOverLoads(name, func, object, select)