summaryrefslogtreecommitdiff
path: root/server/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-18 16:23:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-18 16:23:16 +0800
commit357e62b68d67c4218d95f6bee937e6d5e206d752 (patch)
treed53917e3e64b7f252fcb54116c9e5609fe380805 /server/test
parentde4cec30d4befc0de4bd264c16c52c1a575cd5d3 (diff)
downloadlua-language-server-357e62b68d67c4218d95f6bee937e6d5e206d752.zip
重构文件符号
Diffstat (limited to 'server/test')
-rw-r--r--server/test/crossfile/document_symbol.lua4
-rw-r--r--server/test/document_symbol/init.lua33
2 files changed, 32 insertions, 5 deletions
diff --git a/server/test/crossfile/document_symbol.lua b/server/test/crossfile/document_symbol.lua
index 1ce571d9..015e3638 100644
--- a/server/test/crossfile/document_symbol.lua
+++ b/server/test/crossfile/document_symbol.lua
@@ -109,10 +109,10 @@ local t = {
[1] = {
name = 'x',
detail = EXISTS,
- kind = SymbolKind.Function,
+ kind = SymbolKind.Class,
range = {17, 17},
selectionRange = {17, 17},
- valueRange = {17, 17},
+ valueRange = {21, 31},
},
}
}
diff --git a/server/test/document_symbol/init.lua b/server/test/document_symbol/init.lua
index e17acd9f..929c2253 100644
--- a/server/test/document_symbol/init.lua
+++ b/server/test/document_symbol/init.lua
@@ -170,7 +170,7 @@ end
detail = 'function mt:add()',
kind = SymbolKind.Field,
range = {1, 21},
- selectionRange = {13, 15},
+ selectionRange = {10, 15},
valueRange = {1, 21},
}
}
@@ -285,7 +285,7 @@ local z
},
[4] = {
name = 'z',
- detail = 'local z: any',
+ detail = '',
kind = SymbolKind.Variable,
range = {102, 102},
selectionRange = {102, 102},
@@ -411,12 +411,39 @@ end
kind = SymbolKind.Variable,
range = {27, 27},
selectionRange = {27, 27},
- valueRange = {27, 27},
+ valueRange = {31, 33},
}
}
},
}
+TEST [[
+local t = {
+ a = 1,
+ b = 2,
+}
+
+local v = t
+]]{
+ [1] = {
+ name = 't',
+ detail = EXISTS,
+ kind = SymbolKind.Variable,
+ range = {7, 7},
+ selectionRange = {7, 7},
+ valueRange = {11, 35},
+ children = EXISTS,
+ },
+ [2] = {
+ name = 'v',
+ detail = EXISTS,
+ kind = SymbolKind.Variable,
+ range = {44, 44},
+ selectionRange = {44, 44},
+ valueRange = {48, 48},
+ },
+}
+
-- 临时
local fs = require 'bee.filesystem'
local function testIfExit(path)