summaryrefslogtreecommitdiff
path: root/test/completion
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-23 21:14:53 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-23 21:14:53 +0800
commit6a41f28c76daec6f9bc1f4505ad9e005c5412306 (patch)
tree7728d83d2139cbab9a8ec3db4453a1e2aeac34d2 /test/completion
parente7e7a337a07999a610d903d14aa6e774baa16a8c (diff)
downloadlua-language-server-6a41f28c76daec6f9bc1f4505ad9e005c5412306.zip
improve completion as tableindex
Diffstat (limited to 'test/completion')
-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 2c1a4570..bd3aca25 100644
--- a/test/completion/init.lua
+++ b/test/completion/init.lua
@@ -2139,6 +2139,27 @@ x.a = $
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 = $
}
@@ -2157,3 +2178,24 @@ local x = {
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,
+ },
+}