From be2e0b5a9cfe94f81fd8f5f45b70d8b093c680fe Mon Sep 17 00:00:00 2001 From: kevinhwang91 Date: Mon, 4 Apr 2022 19:42:26 +0800 Subject: fix(completion): use args table instead of args string to parse snippet For now, we parse the `@param f fun(a: any, b: any)` as two placeholders instead of one. BTW, use table have a slightly better performance than spliting args string. --- test/completion/common.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test/completion/common.lua b/test/completion/common.lua index 6543e5f6..58b27fe7 100644 --- a/test/completion/common.lua +++ b/test/completion/common.lua @@ -2480,6 +2480,24 @@ foo insertText = 'foo(${1:a?: any}, ${2:b: any})', }, } + +TEST [[ +---@param f fun(a: any, b: any) +local function foo(f) end +foo +]] +{ + { + label = 'foo(f)', + kind = define.CompletionItemKind.Function, + insertText = 'foo', + }, + { + label = 'foo(f)', + kind = define.CompletionItemKind.Snippet, + insertText = 'foo(${1:f: fun(a: any, b: any)})', + }, +} Cared['insertText'] = false TEST [[ -- cgit v1.2.3