summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-29 13:12:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-29 13:12:58 +0800
commit9036106b25eeee7553d28a1b4f5e27d78ab5287c (patch)
treef97233dd9658ba670136a03b09db68f57d033042 /server/src
parentc01603d8bb9578db568c807061ecbca565f2a86c (diff)
downloadlua-language-server-9036106b25eeee7553d28a1b4f5e27d78ab5287c.zip
过滤掉没爹的field
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/document_symbol.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/server/src/core/document_symbol.lua b/server/src/core/document_symbol.lua
index d4462420..f53e636d 100644
--- a/server/src/core/document_symbol.lua
+++ b/server/src/core/document_symbol.lua
@@ -129,7 +129,7 @@ local function buildVar(vm, var)
}
end
-local function packChild(symbols, finish)
+local function packChild(symbols, finish, kind)
local t
while true do
local symbol = symbols[#symbols]
@@ -140,11 +140,14 @@ local function packChild(symbols, finish)
break
end
symbols[#symbols] = nil
- symbol.children = packChild(symbols, symbol.range[2])
+ symbol.children = packChild(symbols, symbol.range[2], symbol.kind)
if not t then
t = {}
end
- t[#t+1] = symbol
+ if symbol.kind == SymbolKind.Class and kind ~= SymbolKind.Variable then
+ else
+ t[#t+1] = symbol
+ end
end
return t
end
@@ -155,7 +158,7 @@ local function packSymbols(symbols)
return a.range[1] > b.range[1]
end)
-- 处理嵌套
- return packChild(symbols, math.maxinteger)
+ return packChild(symbols, math.maxinteger, SymbolKind.Function)
end
return function (vm)