diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-07-20 16:45:44 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-07-20 16:45:49 +0800 |
commit | d9687d8f1b6a55bdd97a65ba81d9ca2b6cb2357f (patch) | |
tree | 3be6554d16adef74e8c1d42d08c487d214d1928a /test | |
parent | 24b8ab8a1da3b8ae6f6c561ec58e9bd5fcff2c2b (diff) | |
download | lua-language-server-d9687d8f1b6a55bdd97a65ba81d9ca2b6cb2357f.zip |
improve completion label of table fields
Diffstat (limited to 'test')
-rw-r--r-- | test/completion/common.lua | 54 | ||||
-rw-r--r-- | test/full/init.lua | 2 | ||||
-rw-r--r-- | test/full/self.lua | 2 |
3 files changed, 56 insertions, 2 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, + }, +} diff --git a/test/full/init.lua b/test/full/init.lua index ac78f134..a6496a99 100644 --- a/test/full/init.lua +++ b/test/full/init.lua @@ -37,7 +37,7 @@ end) do end end -util.revertTable(times) +util.revertArray(times) for _, time in ipairs(times) do print(time) end diff --git a/test/full/self.lua b/test/full/self.lua index 09d2d154..34b19b2b 100644 --- a/test/full/self.lua +++ b/test/full/self.lua @@ -86,7 +86,7 @@ end) do end end -util.revertTable(printTexts) +util.revertArray(printTexts) for _, text in ipairs(printTexts) do print(text) |