summaryrefslogtreecommitdiff
path: root/test/completion/init.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-23 20:53:07 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-23 20:53:07 +0800
commite7e7a337a07999a610d903d14aa6e774baa16a8c (patch)
treedf98e9df32149da158a00b944af74d0205749156 /test/completion/init.lua
parent64b7635a5022a13df67acc5632497d75b3c378c7 (diff)
downloadlua-language-server-e7e7a337a07999a610d903d14aa6e774baa16a8c.zip
improve completion of field and table
Diffstat (limited to 'test/completion/init.lua')
-rw-r--r--test/completion/init.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/completion/init.lua b/test/completion/init.lua
index 5f79ea21..2c1a4570 100644
--- a/test/completion/init.lua
+++ b/test/completion/init.lua
@@ -2115,3 +2115,45 @@ field cc.aaa: number
},
}
Cared['description'] = nil
+
+TEST [[
+---@type table<string, "'a'"|"'b'"|"'c'">
+local x
+
+x.a = $
+]]
+{
+ {
+ label = "'a'",
+ kind = define.CompletionItemKind.EnumMember,
+ },
+ {
+ label = "'b'",
+ kind = define.CompletionItemKind.EnumMember,
+ },
+ {
+ label = "'c'",
+ kind = define.CompletionItemKind.EnumMember,
+ },
+}
+
+TEST [[
+---@type table<string, "'a'"|"'b'"|"'c'">
+local x = {
+ a = $
+}
+]]
+{
+ {
+ label = "'a'",
+ kind = define.CompletionItemKind.EnumMember,
+ },
+ {
+ label = "'b'",
+ kind = define.CompletionItemKind.EnumMember,
+ },
+ {
+ label = "'c'",
+ kind = define.CompletionItemKind.EnumMember,
+ },
+}