summaryrefslogtreecommitdiff
path: root/server/src/core/hover/function.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-08-27 20:28:01 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-08-27 20:28:01 +0800
commita828a593e119ec222e4ef9e6a737234cabe00245 (patch)
tree8c39fb4a4738bdaa1d6d81173e42ba50903cb368 /server/src/core/hover/function.lua
parentf188a3001de879387fafbb3e875ceafa48e74ab9 (diff)
downloadlua-language-server-a828a593e119ec222e4ef9e6a737234cabe00245.zip
函数调用的代码片段
Diffstat (limited to 'server/src/core/hover/function.lua')
-rw-r--r--server/src/core/hover/function.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua
index 42d6bf6d..eab1ff59 100644
--- a/server/src/core/hover/function.lua
+++ b/server/src/core/hover/function.lua
@@ -33,6 +33,7 @@ local function buildValueArgs(func, object, select)
else
max = math.max(#names, #values)
end
+ local args = {}
for i = start, max do
local name = names[i]
local value = values[i] or 'any'
@@ -56,6 +57,7 @@ local function buildValueArgs(func, object, select)
else
strs[#strs+1] = value
end
+ args[#args+1] = strs[#strs]
if i == select then
strs[#strs+1] = '@ARG'
end
@@ -95,7 +97,7 @@ local function buildValueArgs(func, object, select)
if #argLabel == 0 then
argLabel = nil
end
- return text, argLabel
+ return text, argLabel, args
end
local function buildValueReturns(func)
@@ -215,13 +217,13 @@ local function getOverLoads(name, func, object, select)
end
return function (name, func, object, select)
- local args, argLabel = buildValueArgs(func, object, select)
+ local argStr, argLabel, args = buildValueArgs(func, object, select)
local returns = buildValueReturns(func)
local enum = buildEnum(func)
local comment = getComment(func)
local overloads = getOverLoads(name, func, object, select)
local headLen = #('function %s('):format(name)
- local title = ('function %s(%s)%s'):format(name, args, returns)
+ local title = ('function %s(%s)%s'):format(name, argStr, returns)
if argLabel then
argLabel[1] = argLabel[1] + headLen
argLabel[2] = argLabel[2] + headLen
@@ -232,5 +234,6 @@ return function (name, func, object, select)
enum = enum,
argLabel = argLabel,
overloads = overloads,
+ args = args,
}
end