summaryrefslogtreecommitdiff
path: root/test/completion/common.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/completion/common.lua')
-rw-r--r--test/completion/common.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/completion/common.lua b/test/completion/common.lua
index a6df8da7..e33b2a1b 100644
--- a/test/completion/common.lua
+++ b/test/completion/common.lua
@@ -4307,3 +4307,57 @@ a:<??>
kind = define.CompletionItemKind.Function,
},
}
+
+TEST [[
+---@class A
+---@field x number
+---@field y? number
+---@field z number
+
+---@type A
+local t = {
+ <??>
+}
+]]
+{
+ {
+ label = 'x',
+ kind = define.CompletionItemKind.Property,
+ },
+ {
+ label = 'z',
+ kind = define.CompletionItemKind.Property,
+ },
+ {
+ label = 'y?',
+ kind = define.CompletionItemKind.Property,
+ },
+}
+
+TEST [[
+---@class A
+---@field x number
+---@field y? number
+---@field z number
+
+---@param t A
+local function f(t) end
+
+f {
+ <??>
+}
+]]
+{
+ {
+ label = 'x',
+ kind = define.CompletionItemKind.Property,
+ },
+ {
+ label = 'z',
+ kind = define.CompletionItemKind.Property,
+ },
+ {
+ label = 'y?',
+ kind = define.CompletionItemKind.Property,
+ },
+}