From fa0fe1c857a83d8595d687e49205d7d548aba0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 29 Aug 2022 17:21:59 +0800 Subject: `document-symbol` supports block --- test/document_symbol/init.lua | 95 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) (limited to 'test/document_symbol') diff --git a/test/document_symbol/init.lua b/test/document_symbol/init.lua index 6f80287f..17728efc 100644 --- a/test/document_symbol/init.lua +++ b/test/document_symbol/init.lua @@ -743,3 +743,98 @@ local t = { 1, 2, [5] = 3, [true] = 4, x = 5 } children = EXISTS } } + +TEST [[ +if 1 then + +elseif 2 then + +elseif 3 then + +else + +end +]] +{ + { + name = 'if', + detail = 'if 1 then', + kind = define.SymbolKind.Package, + range = {0, 20000}, + selectionRange = {0, 2}, + valueRange = {0, 20000}, + }, + { + name = 'elseif', + detail = 'elseif 2 then', + kind = define.SymbolKind.Package, + range = {20000, 40000}, + selectionRange = {20000, 20006}, + valueRange = {20000, 40000}, + }, + { + name = 'elseif', + detail = 'elseif 3 then', + kind = define.SymbolKind.Package, + range = {40000, 60000}, + selectionRange = {40000, 40006}, + valueRange = {40000, 60000}, + }, + { + name = 'else', + detail = 'else', + kind = define.SymbolKind.Package, + range = {60000, 80000}, + selectionRange = {60000, 60004}, + valueRange = {60000, 80000}, + }, +} + +TEST [[ +while true do + +end +]] +{ + { + name = 'while', + detail = 'while true do', + kind = define.SymbolKind.Package, + range = {0, 20003}, + selectionRange = {0, 5}, + valueRange = {0, 20003}, + }, +} + +TEST [[ +repeat + +until true +]] +{ + { + name = 'repeat', + detail = 'until true', + kind = define.SymbolKind.Package, + range = {0, 20010}, + selectionRange = {0, 6}, + valueRange = {0, 20010}, + }, +} + +TEST [[ +for i = 1, 10 do + +end +]] +{ + { + name = 'for', + detail = 'for i = 1, 10 do', + kind = define.SymbolKind.Package, + range = {0, 20003}, + selectionRange = {0, 3}, + valueRange = {0, 20003}, + children = EXISTS, + }, +} -- cgit v1.2.3