summaryrefslogtreecommitdiff
path: root/script-beta/core/completion.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-12 21:16:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-12 21:16:48 +0800
commit4e52738f7a315085505ffdbefe9ce6722ec3965f (patch)
tree978b9450f1a8871dbfa538a2b824d289a7a8c234 /script-beta/core/completion.lua
parente2cd0ad08fdb756f251e3def4a4277d22ba54728 (diff)
downloadlua-language-server-4e52738f7a315085505ffdbefe9ce6722ec3965f.zip
暂存
Diffstat (limited to 'script-beta/core/completion.lua')
-rw-r--r--script-beta/core/completion.lua11
1 files changed, 2 insertions, 9 deletions
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