diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-23 21:14:53 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-23 21:14:53 +0800 |
commit | 6a41f28c76daec6f9bc1f4505ad9e005c5412306 (patch) | |
tree | 7728d83d2139cbab9a8ec3db4453a1e2aeac34d2 /test/completion/init.lua | |
parent | e7e7a337a07999a610d903d14aa6e774baa16a8c (diff) | |
download | lua-language-server-6a41f28c76daec6f9bc1f4505ad9e005c5412306.zip |
improve completion as tableindex
Diffstat (limited to 'test/completion/init.lua')
-rw-r--r-- | test/completion/init.lua | 42 |
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, + }, +} |