summaryrefslogtreecommitdiff
path: root/test/completion
diff options
context:
space:
mode:
authorkevinhwang91 <kevin.hwang@live.com>2022-04-04 14:23:12 +0800
committerkevinhwang91 <kevin.hwang@live.com>2022-04-04 14:23:12 +0800
commitb4d112f6140a454e856301b636f101d56820d088 (patch)
treee6afa57b4001669fcdd7bba595f48a81b89e035b /test/completion
parentbc8e292e3bedc423d31abdd4ce040fcf1143d46a (diff)
downloadlua-language-server-b4d112f6140a454e856301b636f101d56820d088.zip
fix(test): add test cases for callSnippet
Diffstat (limited to 'test/completion')
-rw-r--r--test/completion/common.lua84
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 [[