summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/core/document_symbol.lua9
-rw-r--r--server/test/document_symbol/init.lua24
2 files changed, 30 insertions, 3 deletions
diff --git a/server/src/core/document_symbol.lua b/server/src/core/document_symbol.lua
index b06953d9..6044c697 100644
--- a/server/src/core/document_symbol.lua
+++ b/server/src/core/document_symbol.lua
@@ -83,10 +83,13 @@ local function isLocalTable(var)
if var.value.source.start == 0 then
return false
end
- if var.source == var.value.declarat then
- return true
+ if var.source ~= var.value.declarat then
+ return false
+ end
+ if var.value.source.finish < var.source.finish then
+ return false
end
- return false
+ return true
end
local function buildVar(vm, var)
diff --git a/server/test/document_symbol/init.lua b/server/test/document_symbol/init.lua
index 89c18e35..7d7a6b23 100644
--- a/server/test/document_symbol/init.lua
+++ b/server/test/document_symbol/init.lua
@@ -336,6 +336,30 @@ g = 1
}
}
+TEST[[
+function f(...)
+ local x = ...
+ print(x.a)
+end
+]]{
+ [1] = {
+ name = 'f',
+ detail = 'function f(...)',
+ kind = SymbolKind.Function,
+ range = {1, 52},
+ selectionRange = {10, 10},
+ children = {
+ [1] = {
+ name = 'x',
+ detail = EXISTS,
+ kind = SymbolKind.Variable,
+ range = {27, 27},
+ selectionRange = {27, 27},
+ }
+ }
+ },
+}
+
-- 临时
local fs = require 'bee.filesystem'
local function testIfExit(path)