diff options
author | kevinhwang91 <kevin.hwang@live.com> | 2022-04-04 19:42:26 +0800 |
---|---|---|
committer | kevinhwang91 <kevin.hwang@live.com> | 2022-04-04 19:51:57 +0800 |
commit | be2e0b5a9cfe94f81fd8f5f45b70d8b093c680fe (patch) | |
tree | 7bf1d0cd00b0c0fcd97bb25726e50fb2be925791 /test/completion/common.lua | |
parent | 9d595463733c37c649b54d0f5b5db747a5eb7e5e (diff) | |
download | lua-language-server-be2e0b5a9cfe94f81fd8f5f45b70d8b093c680fe.zip |
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.
Diffstat (limited to 'test/completion/common.lua')
-rw-r--r-- | test/completion/common.lua | 18 |
1 files changed, 18 insertions, 0 deletions
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 [[ |