1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 19:40:27 +01:00

Speed up child processing by separating scoped from non-scoped tags

This commit is contained in:
Jan Larres
2011-01-23 15:09:08 +13:00
parent 2fd950e96d
commit f15d130c3a

View File

@@ -413,13 +413,23 @@ function! s:ProcessFile(fname, ftype)
endfor
if has_key(typeinfo, 'scopes') && !empty(typeinfo.scopes)
let processedtags = []
let scopedtags = []
for scope in typeinfo.scopes
call s:AddChildren(fileinfo.tags, processedtags, '',
let is_scoped = 'has_key(typeinfo.kind2scope, v:val.fields.kind) ||
\ has_key(v:val.fields, scope)'
let scopedtags += filter(copy(fileinfo.tags), is_scoped)
call filter(fileinfo.tags, '!(' . is_scoped . ')')
endfor
let processedtags = []
for scope in typeinfo.scopes
call s:AddChildren(scopedtags, processedtags, '',
\ '', scope, 1, typeinfo)
endfor
" 'scopedtags' can still contain some tags that don't have any
" children
call extend(fileinfo.tags, scopedtags)
call extend(fileinfo.tags, processedtags)
endif