summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-27 21:31:50 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-27 21:31:50 +0800
commit4db019185cc52a046fbc630078bed743b9819144 (patch)
treeb2940b5da0be7f82c7905d7ed27d5f1c25c62791 /server/src/core
parent92aa3d6c203aef82a57efbe8216830a016db6d5e (diff)
downloadlua-language-server-4db019185cc52a046fbc630078bed743b9819144.zip
hover支持 enum.comment
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/hover/function.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua
index 2dc15996..b23809f8 100644
--- a/server/src/core/hover/function.lua
+++ b/server/src/core/hover/function.lua
@@ -124,6 +124,24 @@ local function buildEnum(func)
if not params then
return nil
end
+ local strs = {}
+ for _, param in ipairs(params) do
+ local first = true
+ param:eachEnum(function (enum, option)
+ if first then
+ first = false
+ strs[#strs+1] = ('\n%s:%s'):format(param:getName(), param:getType())
+ end
+ strs[#strs+1] = ('\n | %s'):format(enum)
+ if option and option.comment then
+ strs[#strs+1] = ' -- ' .. option.comment
+ end
+ end)
+ end
+ if #strs == 0 then
+ return nil
+ end
+ return table.concat(strs)
end
local function getComment(func)