summaryrefslogtreecommitdiff
path: root/test/completion
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-07-20 16:45:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-07-20 16:45:49 +0800
commitd9687d8f1b6a55bdd97a65ba81d9ca2b6cb2357f (patch)
tree3be6554d16adef74e8c1d42d08c487d214d1928a /test/completion
parent24b8ab8a1da3b8ae6f6c561ec58e9bd5fcff2c2b (diff)
downloadlua-language-server-d9687d8f1b6a55bdd97a65ba81d9ca2b6cb2357f.zip
improve completion label of table fields
Diffstat (limited to 'test/completion')
-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,
+ },
+}