summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-06-13 21:00:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-06-13 21:00:02 +0800
commit484f993c6a1026b7eb04d48ff4aee00e2dcafd54 (patch)
tree2ca3a0da2c4bc39a0c58a2983bb033a1fbefc7ec /test
parent2b5257d3d097c2726e5098a43c333aa20a461c2e (diff)
downloadlua-language-server-484f993c6a1026b7eb04d48ff4aee00e2dcafd54.zip
completion for quoted fields
fix #2088
Diffstat (limited to 'test')
-rw-r--r--test/completion/common.lua43
-rw-r--r--test/crossfile/hover.lua13
2 files changed, 56 insertions, 0 deletions
diff --git a/test/completion/common.lua b/test/completion/common.lua
index 8d53b89a..d38f2912 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -4184,3 +4184,46 @@ end
}
},
}
+
+Cared['description'] = true
+TEST [[
+---@class Foo
+---@field ['with quotes'] integer
+---@field without_quotes integer
+
+---@type Foo
+local bar = {}
+
+bar.<??>
+]]
+{
+ {
+ label = "'with quotes'",
+ kind = define.CompletionItemKind.Field,
+ textEdit = {
+ start = 70004,
+ finish = 70004,
+ newText = "['with quotes']"
+ },
+ additionalTextEdits = {
+ {
+ start = 70003,
+ finish = 70004,
+ newText = '',
+ }
+ },
+ description = [[
+```lua
+(field) Foo['with quotes']: integer
+```]]
+ },
+ {
+ label = 'without_quotes',
+ kind = define.CompletionItemKind.Field,
+ description = [[
+```lua
+(field) Foo.without_quotes: integer
+```]]
+ },
+}
+Cared['description'] = false
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index d013af98..aee9ea0a 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -1795,3 +1795,16 @@ local x: integer = 1
comment1]]
}
+
+TEST { {path = 'a.lua', content = [[
+local t = {}
+
+print(<?t?>['a b'])
+]]},
+hover = [[
+```lua
+local t: {
+ ['a b']: unknown,
+}
+```]]
+}