diff options
author | kevinhwang91 <kevin.hwang@live.com> | 2022-04-04 14:23:12 +0800 |
---|---|---|
committer | kevinhwang91 <kevin.hwang@live.com> | 2022-04-04 14:23:12 +0800 |
commit | b4d112f6140a454e856301b636f101d56820d088 (patch) | |
tree | e6afa57b4001669fcdd7bba595f48a81b89e035b /test | |
parent | bc8e292e3bedc423d31abdd4ce040fcf1143d46a (diff) | |
download | lua-language-server-b4d112f6140a454e856301b636f101d56820d088.zip |
fix(test): add test cases for callSnippet
Diffstat (limited to 'test')
-rw-r--r-- | test/completion/common.lua | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/test/completion/common.lua b/test/completion/common.lua index 95903acb..fa261a5f 100644 --- a/test/completion/common.lua +++ b/test/completion/common.lua @@ -2373,6 +2373,90 @@ zzzz<??> insertText = 'zzzz(${1:a: any}, ${2:b: any})', }, } + +TEST [[ +---@param a any +---@param b? any +---@param c? any +---@vararg any +local function foo(a, b, c, ...) end +foo<??> +]] +{ + { + label = 'foo(a, b, c, ...)', + kind = define.CompletionItemKind.Function, + insertText = 'foo', + }, + { + label = 'foo(a, b, c, ...)', + kind = define.CompletionItemKind.Snippet, + insertText = 'foo(${1:a: any})', + }, +} + +TEST [[ +---@param a any +---@param b? any +---@param c? any +---@vararg any +local function foo(a, b, c, ...) end +foo<??> +]] +{ + { + label = 'foo(a, b, c, ...)', + kind = define.CompletionItemKind.Function, + insertText = 'foo', + }, + { + label = 'foo(a, b, c, ...)', + kind = define.CompletionItemKind.Snippet, + insertText = 'foo(${1:a: any})', + }, +} + +TEST [[ +---@param a? any +---@param b? any +---@param c? any +---@vararg any +local function foo(a, b, c, ...) end +foo<??> +]] +{ + { + label = 'foo(a, b, c, ...)', + kind = define.CompletionItemKind.Function, + insertText = 'foo', + }, + { + label = 'foo(a, b, c, ...)', + kind = define.CompletionItemKind.Snippet, + insertText = 'foo($1)', + }, +} + +TEST [[ +---@param a? any +---@param b any +---@param c? any +---@vararg any +local function foo(a, b, c, ...) end +foo<??> +]] +{ + { + label = 'foo(a, b, c, ...)', + kind = define.CompletionItemKind.Function, + insertText = 'foo', + }, + { + label = 'foo(a, b, c, ...)', + kind = define.CompletionItemKind.Snippet, + insertText = 'foo(${1:a?: any}, ${2:b: any})', + }, +} Cared['insertText'] = false TEST [[ |