diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-29 10:54:21 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-29 10:54:21 +0800 |
commit | 55f143578193ac434b18d77bbbdacc468ff340c7 (patch) | |
tree | 37d849a2d93f1382d862103a63a34cb2bf25e8a6 /server/test/document_symbol | |
parent | 7d2e059198799acd874e8399bcb25920414e28da (diff) | |
download | lua-language-server-55f143578193ac434b18d77bbbdacc468ff340c7.zip |
大纲支持局部变量
Diffstat (limited to 'server/test/document_symbol')
-rw-r--r-- | server/test/document_symbol/init.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/server/test/document_symbol/init.lua b/server/test/document_symbol/init.lua index eac54f8a..52896461 100644 --- a/server/test/document_symbol/init.lua +++ b/server/test/document_symbol/init.lua @@ -151,6 +151,15 @@ end kind = SymbolKind.Field, range = {1, 21}, selectionRange = {13, 15}, + children = { + [1] = { + name = 'self', + detail = EXISTS, + kind = SymbolKind.Variable, + range = {10, 11}, + selectionRange = {10, 11}, + } + } } } @@ -196,3 +205,51 @@ end selectionRange = {79, 79}, }, } + +TEST [[ +local x = 1 +local function f() + local x = 'x' + local y = {} +end +local y = true +]] +{ + [1] = { + name = 'x', + detail = 'local x: number = 1', + kind = SymbolKind.Variable, + range = {7, 7}, + selectionRange = {7, 7}, + }, + [2] = { + name = 'f', + detail = 'function f()', + kind = SymbolKind.Function, + range = {13, 69}, + selectionRange = {28, 28}, + children = { + [1] = { + name = 'x', + detail = 'local x: string = "x"', + kind = SymbolKind.Variable, + range = {42, 42}, + selectionRange = {42, 42}, + }, + [2] = { + name = 'y', + detail = 'local y: {}', + kind = SymbolKind.Variable, + range = {60, 60}, + selectionRange = {60, 60}, + }, + }, + }, + [3] = { + name = 'y', + detail = 'local y: boolean = true', + kind = SymbolKind.Variable, + range = {77, 77}, + selectionRange = {77, 77}, + }, +} |