summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-08-24 21:18:22 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-08-24 21:18:22 +0800
commit47ae75485c5735d5f5960db84de8e706457fabe4 (patch)
tree8ea81cc56b4195b88947e08641e587c21b07c3c9 /test
parentdaf1780795bb57fbe80e98a6989a5875f20f8bdc (diff)
downloadlua-language-server-47ae75485c5735d5f5960db84de8e706457fabe4.zip
cleanup document-symbol
Diffstat (limited to 'test')
-rw-r--r--test/document_symbol/init.lua149
1 files changed, 99 insertions, 50 deletions
diff --git a/test/document_symbol/init.lua b/test/document_symbol/init.lua
index 4ce75573..2150e879 100644
--- a/test/document_symbol/init.lua
+++ b/test/document_symbol/init.lua
@@ -62,8 +62,8 @@ A = 1
{
[1] = {
name = 'A',
- detail = 'global number = 1',
- kind = define.SymbolKind.Class,
+ detail = '1',
+ kind = define.SymbolKind.Number,
range = {0, 5},
selectionRange = {0, 1},
}
@@ -219,8 +219,8 @@ local z
{
[1] = {
name = 'x',
- detail = 'local number = 1',
- kind = define.SymbolKind.Variable,
+ detail = '1',
+ kind = define.SymbolKind.Number,
range = {6, 11},
selectionRange = {6, 7},
},
@@ -234,15 +234,15 @@ local z
children = {
[1] = {
name = 'x',
- detail = 'local string = "x"',
- kind = define.SymbolKind.Variable,
+ detail = '"x"',
+ kind = define.SymbolKind.String,
range = {20010, 20017},
selectionRange = {20010, 20011},
},
[2] = {
name = 'y',
- detail = 'local {}',
- kind = define.SymbolKind.Variable,
+ detail = '',
+ kind = define.SymbolKind.Object,
range = {30010, 30016},
selectionRange = {30010, 30011},
valueRange = {30014, 30016},
@@ -259,14 +259,14 @@ local z
},
[3] = {
name = 'y',
- detail = 'local boolean = true',
- kind = define.SymbolKind.Variable,
+ detail = 'true',
+ kind = define.SymbolKind.Boolean,
range = {60006, 60014},
selectionRange = {60006, 60007},
},
[4] = {
name = 'z',
- detail = 'local',
+ detail = '',
kind = define.SymbolKind.Variable,
range = {70006, 70007},
selectionRange = {70006, 70007},
@@ -283,33 +283,82 @@ local t = {
{
[1] = {
name = 't',
- detail = 'local {a, b, c}',
- kind = define.SymbolKind.Variable,
+ detail = '{a, b, c}',
+ kind = define.SymbolKind.Object,
range = {6, 40001},
selectionRange = {6, 7},
valueRange = {10, 40001},
children = {
[1] = {
name = 'a',
- detail = 'field number = 1',
- kind = define.SymbolKind.Property,
+ detail = '1',
+ kind = define.SymbolKind.Number,
+ range = {10004, 10009},
+ selectionRange = {10004, 10005},
+ },
+ [2] = {
+ name = 'b',
+ detail = '2',
+ kind = define.SymbolKind.Number,
+ range = {20004, 20009},
+ selectionRange = {20004, 20005},
+ },
+ [3] = {
+ name = 'c',
+ detail = '3',
+ kind = define.SymbolKind.Number,
+ range = {30004, 30009},
+ selectionRange = {30004, 30005},
+ },
+ }
+ }
+}
+
+TEST [[
+local t = {
+ a = 1,
+ b = 2,
+ c = 3,
+ d = 4,
+}
+]]
+{
+ [1] = {
+ name = 't',
+ detail = '{a, b, c, ...(+1)}',
+ kind = define.SymbolKind.Object,
+ range = {6, 50001},
+ selectionRange = {6, 7},
+ valueRange = {10, 50001},
+ children = {
+ [1] = {
+ name = 'a',
+ detail = '1',
+ kind = define.SymbolKind.Number,
range = {10004, 10009},
selectionRange = {10004, 10005},
},
[2] = {
name = 'b',
- detail = 'field number = 2',
- kind = define.SymbolKind.Property,
+ detail = '2',
+ kind = define.SymbolKind.Number,
range = {20004, 20009},
selectionRange = {20004, 20005},
},
[3] = {
name = 'c',
- detail = 'field number = 3',
- kind = define.SymbolKind.Property,
+ detail = '3',
+ kind = define.SymbolKind.Number,
range = {30004, 30009},
selectionRange = {30004, 30005},
},
+ [4] = {
+ name = 'd',
+ detail = '4',
+ kind = define.SymbolKind.Number,
+ range = {40004, 40009},
+ selectionRange = {40004, 40005},
+ },
}
}
}
@@ -324,24 +373,24 @@ local t = {
{
[1] = {
name = 't',
- detail = 'local {a}',
- kind = define.SymbolKind.Variable,
+ detail = '{a}',
+ kind = define.SymbolKind.Object,
range = {6, 40001},
selectionRange = {6, 7},
valueRange = {10, 40001},
children = {
[1] = {
name = 'a',
- detail = 'field {b}',
- kind = define.SymbolKind.Property,
+ detail = '{b}',
+ kind = define.SymbolKind.Object,
range = {10004, 30005},
selectionRange = {10004, 10005},
valueRange = {10008, 30005},
children = {
[1] = {
name = 'b',
- detail = EXISTS,
- kind = define.SymbolKind.Property,
+ detail = '1',
+ kind = define.SymbolKind.Number,
range = {20008, 20013},
selectionRange = {20008, 20009},
}
@@ -367,8 +416,8 @@ g = 1
},
[2] = {
name = 'g',
- detail = 'setlocal number = 1',
- kind = define.SymbolKind.Variable,
+ detail = '1',
+ kind = define.SymbolKind.Number,
range = {30000, 30005},
selectionRange = {30000, 30001},
}
@@ -390,21 +439,21 @@ end
children = {
[1] = {
name = 'a',
- detail = 'param',
+ detail = '',
kind = define.SymbolKind.Constant,
range = {11, 12},
selectionRange = {11, 12},
},
[2] = {
name = 'b',
- detail = 'param',
+ detail = '',
kind = define.SymbolKind.Constant,
range = {14, 15},
selectionRange = {14, 15},
},
[3] = {
name = 'x',
- detail = 'local',
+ detail = '',
kind = define.SymbolKind.Variable,
range = {10010, 10017},
selectionRange = {10010, 10011},
@@ -423,8 +472,8 @@ local v = t
]]{
[1] = {
name = 't',
- detail = 'local {a, b}',
- kind = define.SymbolKind.Variable,
+ detail = '{a, b}',
+ kind = define.SymbolKind.Object,
range = {6, 30001},
selectionRange = {6, 7},
valueRange = {10, 30001},
@@ -432,7 +481,7 @@ local v = t
},
[2] = {
name = 'v',
- detail = 'local',
+ detail = '',
kind = define.SymbolKind.Variable,
range = {50006, 50011},
selectionRange = {50006, 50007},
@@ -445,7 +494,7 @@ local function
]]{
[1] = {
name = 'x',
- detail = 'local',
+ detail = '',
kind = define.SymbolKind.Variable,
range = {6, 7},
selectionRange = {6, 7},
@@ -453,7 +502,7 @@ local function
[2] = {
name = "",
detail = "function ()",
- kind = 12,
+ kind = define.SymbolKind.Function,
range = {10006, 10014},
selectionRange = {10006, 10014},
valueRange = {10006, 10014},
@@ -474,8 +523,8 @@ local a, b = {
]]{
[1] = {
name = 'a',
- detail = 'local {x1, y1, z1}',
- kind = define.SymbolKind.Variable,
+ detail = '{x1, y1, z1}',
+ kind = define.SymbolKind.Object,
range = {6, 40001},
selectionRange = {6, 7},
valueRange = {13, 40001},
@@ -483,8 +532,8 @@ local a, b = {
},
[2] = {
name = 'b',
- detail = 'local {x2, y2, z2}',
- kind = define.SymbolKind.Variable,
+ detail = '{x2, y2, z2}',
+ kind = define.SymbolKind.Object,
range = {9, 80001},
selectionRange = {9, 10},
valueRange = {40003, 80001},
@@ -519,7 +568,7 @@ end
children = {
[1] = {
name = 'c',
- detail = 'local',
+ detail = '',
kind = define.SymbolKind.Variable,
range = {40010, 40011},
selectionRange = {40010, 40011},
@@ -536,7 +585,7 @@ local t = f({
{
[1] = {
name = 't',
- detail = 'local',
+ detail = '',
kind = define.SymbolKind.Variable,
range = {6, 20002},
selectionRange = {6, 7},
@@ -544,8 +593,8 @@ local t = f({
children = {
[1] = {
name = 'k',
- detail = 'field number = 1',
- kind = define.SymbolKind.Property,
+ detail = '1',
+ kind = define.SymbolKind.Number,
range = {10004, 10009},
selectionRange = {10004, 10005},
}
@@ -562,8 +611,8 @@ end
{
[1] = {
name = 't',
- detail = 'local {}',
- kind = define.SymbolKind.Variable,
+ detail = '',
+ kind = define.SymbolKind.Object,
range = {6, 12},
selectionRange = {6, 7},
valueRange = {10, 12},
@@ -578,14 +627,14 @@ end
children = {
[1] = {
name = 'a',
- detail = 'param',
+ detail = '',
kind = define.SymbolKind.Constant,
range = {20017, 20018},
selectionRange = {20017, 20018},
},
[2] = {
name = 'b',
- detail = 'param',
+ detail = '',
kind = define.SymbolKind.Constant,
range = {20020, 20021},
selectionRange = {20020, 20021},
@@ -603,7 +652,7 @@ local a = f {
{
[1] = {
name = 'a',
- detail = 'local',
+ detail = '',
kind = define.SymbolKind.Variable,
range = {6, 30001},
selectionRange = {6, 7},
@@ -649,8 +698,8 @@ local root = {
{
[1] = {
name = 'root',
- detail = 'local {inner_function}',
- kind = define.SymbolKind.Variable,
+ detail = '{inner_function}',
+ kind = define.SymbolKind.Object,
range = {6, 50001},
selectionRange = {6, 10},
valueRange = {13, 50001},