From 3391ab935f18e928da414c19a84e7afc4acee779 Mon Sep 17 00:00:00 2001 From: sumneko Date: Thu, 25 Apr 2019 19:57:02 +0800 Subject: =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E8=87=AA=E5=8A=A8=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/completion.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'server/src/core') diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index eb4e9a1d..1ae88c8f 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -436,6 +436,21 @@ local function searchEmmyFunctionParam(vm, source, word, callback) if not func.args then return end + if word == '' then + local list = {} + local args = {} + for i, arg in ipairs(func.args) do + args[i] = arg.name + if i == 1 then + list[i] = ('%s any'):format(arg.name) + else + list[i] = ('---@param %s any'):format(arg.name) + end + end + callback(('(%s)'):format(table.concat(args, ', ')), nil, CompletionItemKind.Snippet, { + insertText = table.concat(list, '\n') + }) + end for _, arg in ipairs(func.args) do if matchKey(word, arg.name) then callback(arg.name, arg, CompletionItemKind.Interface) -- cgit v1.2.3