summaryrefslogtreecommitdiff
path: root/test-beta/completion/init.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-09-16 17:58:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-09-16 17:58:42 +0800
commit8398aa93fc8e92eda1ee259ebe256d8eda820e09 (patch)
tree6d637b85af910e35ec077ff2aad4e86551696c47 /test-beta/completion/init.lua
parentf0e3b9d18c95af0f5f8581bbc0ab46bd882337d4 (diff)
downloadlua-language-server-8398aa93fc8e92eda1ee259ebe256d8eda820e09.zip
修正一些bug
Diffstat (limited to 'test-beta/completion/init.lua')
-rw-r--r--test-beta/completion/init.lua204
1 files changed, 103 insertions, 101 deletions
diff --git a/test-beta/completion/init.lua b/test-beta/completion/init.lua
index 6d4da4c7..b0cfd4e2 100644
--- a/test-beta/completion/init.lua
+++ b/test-beta/completion/init.lua
@@ -1001,6 +1001,109 @@ mt:f$
},
}
+-- TODO
+do return end
+TEST [[
+local function f()
+ if a then
+ else$
+end
+]]
+{
+ {
+ label = 'select',
+ kind = CompletionItemKind.Function,
+ detail = EXISTS,
+ },
+ {
+ label = 'select()',
+ kind = CompletionItemKind.Snippet,
+ detail = EXISTS,
+ insertText = EXISTS,
+ },
+ {
+ label = 'setmetatable',
+ kind = CompletionItemKind.Function,
+ detail = EXISTS,
+ },
+ {
+ label = 'setmetatable()',
+ kind = CompletionItemKind.Snippet,
+ detail = EXISTS,
+ insertText = EXISTS,
+ },
+ {
+ label = 'else',
+ kind = CompletionItemKind.Keyword,
+ },
+ {
+ label = 'elseif',
+ kind = CompletionItemKind.Keyword,
+ },
+ {
+ label = 'elseif .. then',
+ kind = CompletionItemKind.Snippet,
+ insertText = EXISTS,
+ },
+}
+
+TEST [[
+local t = {
+ ['a.b.c'] = {}
+}
+
+t.$
+]]
+{
+ {
+ label = 'a.b.c',
+ kind = CompletionItemKind.Field,
+ detail = EXISTS,
+ textEdit = {
+ start = 37,
+ finish = 36,
+ newText = '["a.b.c"]',
+ },
+ additionalTextEdits = {
+ {
+ start = 36,
+ finish = 36,
+ newText = '',
+ }
+ }
+ }
+}
+
+TEST [[
+_ENV['z.b.c'] = {}
+
+z$
+]]
+{
+ {
+ label = 'z.b.c',
+ kind = CompletionItemKind.Field,
+ detail = EXISTS,
+ textEdit = {
+ start = 22,
+ finish = 21,
+ newText = '_ENV["z.b.c"]',
+ },
+ additionalTextEdits = {
+ {
+ start = 21,
+ finish = 21,
+ newText = '',
+ }
+ }
+ }
+}
+
+TEST [[
+io.close(1, $)
+]]
+(nil)
+
do return end
TEST [[
---@$
@@ -1272,50 +1375,6 @@ mt.$
}
TEST [[
-local function f()
- if a then
- else$
-end
-]]
-{
- {
- label = 'select',
- kind = CompletionItemKind.Function,
- detail = EXISTS,
- },
- {
- label = 'select()',
- kind = CompletionItemKind.Snippet,
- detail = EXISTS,
- insertText = EXISTS,
- },
- {
- label = 'setmetatable',
- kind = CompletionItemKind.Function,
- detail = EXISTS,
- },
- {
- label = 'setmetatable()',
- kind = CompletionItemKind.Snippet,
- detail = EXISTS,
- insertText = EXISTS,
- },
- {
- label = 'else',
- kind = CompletionItemKind.Keyword,
- },
- {
- label = 'elseif',
- kind = CompletionItemKind.Keyword,
- },
- {
- label = 'elseif .. then',
- kind = CompletionItemKind.Snippet,
- insertText = EXISTS,
- },
-}
-
-TEST [[
---@param x string | "'AAA'" | "'BBB'" | "'CCC'"
function f(y, x)
end
@@ -1447,63 +1506,6 @@ end)
(nil)
TEST [[
-local t = {
- ['a.b.c'] = {}
-}
-
-t.$
-]]
-{
- {
- label = 'a.b.c',
- kind = CompletionItemKind.Field,
- detail = EXISTS,
- textEdit = {
- start = 37,
- finish = 36,
- newText = '["a.b.c"]',
- },
- additionalTextEdits = {
- {
- start = 36,
- finish = 36,
- newText = '',
- }
- }
- }
-}
-
-TEST [[
-_ENV['z.b.c'] = {}
-
-z$
-]]
-{
- {
- label = 'z.b.c',
- kind = CompletionItemKind.Field,
- detail = EXISTS,
- textEdit = {
- start = 22,
- finish = 21,
- newText = '_ENV["z.b.c"]',
- },
- additionalTextEdits = {
- {
- start = 21,
- finish = 21,
- newText = '',
- }
- }
- }
-}
-
-TEST [[
-io.close(1, $)
-]]
-(nil)
-
-TEST [[
--- JustTest
---@overload fun(list:table):string
---@overload fun(list:table, sep:string):string