From 23673d7c4953d4d99d9b59b449ead9b403177cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 11 Nov 2020 19:58:46 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=8F=82=E6=95=B0=E4=B8=AD=E6=9C=89?= =?UTF-8?q?=E4=B8=8D=E5=AE=9A=E5=8F=82=E6=97=B6=EF=BC=8Cdoc.param=20?= =?UTF-8?q?=E7=9A=84=E8=A1=A5=E5=85=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/core/completion.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'script-beta/core') 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 -- cgit v1.2.3