diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-06-13 21:00:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-06-13 21:00:02 +0800 |
commit | 484f993c6a1026b7eb04d48ff4aee00e2dcafd54 (patch) | |
tree | 2ca3a0da2c4bc39a0c58a2983bb033a1fbefc7ec /test | |
parent | 2b5257d3d097c2726e5098a43c333aa20a461c2e (diff) | |
download | lua-language-server-484f993c6a1026b7eb04d48ff4aee00e2dcafd54.zip |
completion for quoted fields
fix #2088
Diffstat (limited to 'test')
-rw-r--r-- | test/completion/common.lua | 43 | ||||
-rw-r--r-- | test/crossfile/hover.lua | 13 |
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, +} +```]] +} |