summaryrefslogtreecommitdiff
path: root/script-beta/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-11 19:58:46 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-11 19:58:46 +0800
commit23673d7c4953d4d99d9b59b449ead9b403177cb4 (patch)
tree4fa89f684dbca9eb1307b417b0f71916afef5125 /script-beta/core
parentcf646670972e75d38fbbd7f18e9ccf47de73f3fc (diff)
downloadlua-language-server-23673d7c4953d4d99d9b59b449ead9b403177cb4.zip
修正参数中有不定参时,doc.param 的补全问题
Diffstat (limited to 'script-beta/core')
-rw-r--r--script-beta/core/completion.lua22
1 files changed, 13 insertions, 9 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua
index 2b0b8e93..aff4d9f3 100644
--- a/script-beta/core/completion.lua
+++ b/script-beta/core/completion.lua
@@ -1156,11 +1156,13 @@ local function tryLuaDocByErr(ast, offset, err, docState, results)
local label = {}
local insertText = {}
for i, arg in ipairs(func.args) do
- label[i] = arg[1]
- if i == 1 then
- insertText[i] = ('%s any'):format(arg[1])
- else
- insertText[i] = ('---@param %s any'):format(arg[1])
+ if arg[1] then
+ label[#label+1] = arg[1]
+ if i == 1 then
+ insertText[i] = ('%s any'):format(arg[1])
+ else
+ insertText[i] = ('---@param %s any'):format(arg[1])
+ end
end
end
results[#results+1] = {
@@ -1169,10 +1171,12 @@ local function tryLuaDocByErr(ast, offset, err, docState, results)
insertText = table.concat(insertText, '\n'),
}
for i, arg in ipairs(func.args) do
- results[#results+1] = {
- label = arg[1],
- kind = define.CompletionItemKind.Interface,
- }
+ if arg[1] then
+ results[#results+1] = {
+ label = arg[1],
+ kind = define.CompletionItemKind.Interface,
+ }
+ end
end
end
end