summaryrefslogtreecommitdiff
path: root/server/test/completion/init.lua
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-05-14 10:50:08 +0800
committersumneko <sumneko@hotmail.com>2019-05-14 10:50:08 +0800
commitefb8c6f705a940831fbdb8b7246ba6206ddf9220 (patch)
tree7625f1feb581ccf613bd1fcddbd4e1ab77e8754b /server/test/completion/init.lua
parent8adaa0391068da2c6b7a65ef52badebe8fd533f6 (diff)
downloadlua-language-server-efb8c6f705a940831fbdb8b7246ba6206ddf9220.zip
field的自动完成包含不合法字符时,转换为 [%q] 的格式
Diffstat (limited to 'server/test/completion/init.lua')
-rw-r--r--server/test/completion/init.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/server/test/completion/init.lua b/server/test/completion/init.lua
index 5e9b303e..86fa1f28 100644
--- a/server/test/completion/init.lua
+++ b/server/test/completion/init.lua
@@ -1184,3 +1184,53 @@ f(function ()
end)
]]
(nil)
+
+TEST [[
+local t = {
+ ['a.b.c'] = {}
+}
+
+t.$
+]]
+{
+ {
+ label = 'a.b.c',
+ kind = CompletionItemKind.Field,
+ textEdit = {
+ start = 37,
+ finish = 36,
+ newText = '["a.b.c"]',
+ },
+ additionalTextEdits = {
+ {
+ start = 36,
+ finish = 36,
+ newText = '',
+ }
+ }
+ }
+}
+
+TEST [[
+_ENV['z.b.c'] = {}
+
+z$
+]]
+{
+ {
+ label = 'z.b.c',
+ kind = CompletionItemKind.Field,
+ textEdit = {
+ start = 22,
+ finish = 21,
+ newText = '_ENV["z.b.c"]',
+ },
+ additionalTextEdits = {
+ {
+ start = 21,
+ finish = 21,
+ newText = '',
+ }
+ }
+ }
+}