summaryrefslogtreecommitdiff
path: root/server/src/core/hover/lib_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/lib_function.lua
parent7d041b4d7507190141eaac05501d479b77aa8771 (diff)
downloadlua-language-server-f3ef253b0c5ced3727e96df88fa16886f03325ec.zip
调用片段支持枚举
Diffstat (limited to 'server/src/core/hover/lib_function.lua')
-rw-r--r--server/src/core/hover/lib_function.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/src/core/hover/lib_function.lua b/server/src/core/hover/lib_function.lua
index 75e70064..57ba1417 100644
--- a/server/src/core/hover/lib_function.lua
+++ b/server/src/core/hover/lib_function.lua
@@ -149,6 +149,7 @@ local function buildEnum(lib)
::NEXT_ENUM::
end
local strs = {}
+ local raw = {}
for name, enums in pairs(container) do
local tp
if type(enums.type) == 'table' then
@@ -157,6 +158,7 @@ local function buildEnum(lib)
tp = enums.type
end
strs[#strs+1] = ('\n%s: %s'):format(name, tp or 'any')
+ raw[name] = {}
for _, enum in ipairs(enums) do
if enum.default then
strs[#strs+1] = '\n -> '
@@ -168,12 +170,13 @@ local function buildEnum(lib)
else
strs[#strs+1] = tostring(enum.enum)
end
+ raw[name][#raw[name]+1] = strs[#strs]
if enum.description then
strs[#strs+1] = ' -- ' .. enum.description
end
end
end
- return table.concat(strs)
+ return table.concat(strs), raw
end
local function buildDoc(lib)
@@ -198,7 +201,7 @@ end
return function (name, lib, object, select)
local argStr, argLabel, args = buildLibArgs(lib, object, select)
local returns = buildLibReturns(lib)
- local enum = buildEnum(lib)
+ local enum, rawEnum = buildEnum(lib)
local tip = lib.description
local doc = buildDoc(lib)
local headLen = #('function %s('):format(name)
@@ -211,6 +214,7 @@ return function (name, lib, object, select)
label = title,
description = tip,
enum = enum,
+ rawEnum = rawEnum,
argLabel = argLabel,
doc = doc,
args = args,