From 328db97c169dfa44607acebd09bd63ca22491733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 10 Dec 2019 14:10:01 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=87=BD=E6=95=B0=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/core/completion.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'script-beta/core/completion.lua') diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 3d14779f..8e7dfdf9 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -117,8 +117,15 @@ end local function buildFunctionSnip(source) local name = getName(source) - local arg = getArg(source) - return ('%s(%s)'):format(name, arg) + local args = getArg(source) + local id = 0 + args = args:gsub('[^,]+', function (arg) + id = id + 1 + return arg:gsub('^(%s*)(.+)', function (sp, word) + return ('%s${%d:%s}'):format(sp, id, word) + end) + end) + return ('%s(%s)'):format(name, args) end local function buildFunction(results, source, oop, data) @@ -131,6 +138,7 @@ local function buildFunction(results, source, oop, data) snipData.kind = ckind.Snippet snipData.label = snipData.label .. '()' snipData.insertText = buildFunctionSnip(source) + snipData.insertTextFormat = 2 results[#results+1] = snipData end end -- cgit v1.2.3