summaryrefslogtreecommitdiff
path: root/server/src/core/hover/function.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-08-27 21:36:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-08-27 21:36:43 +0800
commitf3ef253b0c5ced3727e96df88fa16886f03325ec (patch)
treedd416f67f75b00e85a7acb515efecfcfde419e30 /server/src/core/hover/function.lua
parent7d041b4d7507190141eaac05501d479b77aa8771 (diff)
downloadlua-language-server-f3ef253b0c5ced3727e96df88fa16886f03325ec.zip
调用片段支持枚举
Diffstat (limited to 'server/src/core/hover/function.lua')
-rw-r--r--server/src/core/hover/function.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua
index eab1ff59..6f8f325c 100644
--- a/server/src/core/hover/function.lua
+++ b/server/src/core/hover/function.lua
@@ -159,8 +159,11 @@ local function buildEnum(func)
return nil
end
local strs = {}
+ local raw = {}
for _, param in ipairs(params) do
local first = true
+ local name = param:getName()
+ raw[name] = {}
param:eachEnum(function (enum)
if first then
first = false
@@ -174,12 +177,13 @@ local function buildEnum(func)
if enum.comment then
strs[#strs+1] = ' -- ' .. enum.comment
end
+ raw[name][#raw[name]+1] = enum[1]
end)
end
if #strs == 0 then
return nil
end
- return table.concat(strs)
+ return table.concat(strs), raw
end
local function getComment(func)
@@ -219,7 +223,7 @@ end
return function (name, func, object, select)
local argStr, argLabel, args = buildValueArgs(func, object, select)
local returns = buildValueReturns(func)
- local enum = buildEnum(func)
+ local enum, rawEnum = buildEnum(func)
local comment = getComment(func)
local overloads = getOverLoads(name, func, object, select)
local headLen = #('function %s('):format(name)
@@ -232,6 +236,7 @@ return function (name, func, object, select)
label = title,
description = comment,
enum = enum,
+ rawEnum = rawEnum,
argLabel = argLabel,
overloads = overloads,
args = args,