From 38e99ef72c4cb477bf84b07d1d185d8c92abf4b7 Mon Sep 17 00:00:00 2001 From: jez Date: Sat, 12 Mar 2011 01:11:02 -0500 Subject: [PATCH] Factor out scope string generation. --- plugin/taglist.vim | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/plugin/taglist.vim b/plugin/taglist.vim index 575700a..e75bd0e 100644 --- a/plugin/taglist.vim +++ b/plugin/taglist.vim @@ -2205,12 +2205,7 @@ function! s:Tlist_Parse_Tagline(tag_line,ftype) " Add the tag scope, if it is available and is configured. Tag " scope is the last field after the 'line:\t' field if g:Tlist_Display_Tag_Scope - let tag_scopes = s:Tlist_Extract_Tag_Scope(a:tag_line) - for [extradata_name, extradata_content] in items(tag_scopes) - if !exists('g:Tlist_{a:ftype}_Show_Extras') || match(g:Tlist_{a:ftype}_Show_Extras, extradata_name) != -1 - let ttxt = ttxt . ' [' . extradata_content . ']' - endif - endfor + let ttxt .= s:Tlist_Get_Scope_String(a:tag_line, a:ftype) endif endif @@ -2226,6 +2221,17 @@ function! s:Tlist_Parse_Tagline(tag_line,ftype) let {fidx_tidx}_tag_name = tag_name endfunction +function! s:Tlist_Get_Scope_String(tag_line, ftype) + let ttxt = '' + let tag_scopes = s:Tlist_Extract_Tag_Scope(a:tag_line) + for [extradata_name, extradata_content] in items(tag_scopes) + if !exists('g:Tlist_{a:ftype}_Show_Extras') || match(g:Tlist_{a:ftype}_Show_Extras, extradata_name) != -1 + let ttxt = ttxt . ' [' . extradata_content . ']' + endif + endfor + return ttxt +endfunction + " Tlist_Process_File " Get the list of tags defined in the specified file and store them " in Vim variables. Returns the file index where the tags are stored. @@ -2431,12 +2437,7 @@ function! s:Tlist_Process_File(filename, ftype) " Add the tag scope, if it is available and is configured. Tag " scope is the last field after the 'line:\t' field if g:Tlist_Display_Tag_Scope - let tag_scopes = s:Tlist_Extract_Tag_Scope(a:tag_line) - for [extradata_name, extradata_content] in items(tag_scopes) - if !exists('g:Tlist_{a:ftype}_Show_Extras') || match(g:Tlist_{a:ftype}_Show_Extras, extradata_name) != -1 - let ttxt = ttxt . ' [' . extradata_content . ']' - endif - endfor + let ttxt .= s:Tlist_Get_Scope_String(a:tag_line, a:ftype) endif endif