From 4e52738f7a315085505ffdbefe9ce6722ec3965f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 12 Nov 2020 21:16:48 +0800 Subject: =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/core/completion.lua | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'script-beta/core/completion.lua') diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 67dc9af2..02c6673c 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -1176,20 +1176,13 @@ local function tryLuaDocByErr(ast, offset, err, docState, results) end local label = {} local insertText = {} - local max = 0 - for _, arg in ipairs(func.args) do - if arg[1] then - max = max + 1 - end - end for i, arg in ipairs(func.args) do if arg[1] then label[#label+1] = arg[1] - local index = i == max and 0 or i if i == 1 then - insertText[i] = ('%s ${%d:any}'):format(arg[1], index) + insertText[i] = ('%s ${%d:any}'):format(arg[1], i) else - insertText[i] = ('---@param %s ${%d:any}'):format(arg[1], index) + insertText[i] = ('---@param %s ${%d:any}'):format(arg[1], i) end end end -- cgit v1.2.3