mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 19:40:27 +01:00
Support 'kind' field with name, ref #254
This commit is contained in:
@@ -2077,8 +2077,10 @@ function! s:ProcessFile(fname, ftype) abort
|
||||
let parts = split(line, ';"')
|
||||
if len(parts) == 2 " Is a valid tag line
|
||||
let taginfo = s:ParseTagline(parts[0], parts[1], typeinfo, fileinfo)
|
||||
let fileinfo.fline[taginfo.fields.line] = taginfo
|
||||
call add(fileinfo.tags, taginfo)
|
||||
if !empty(taginfo)
|
||||
let fileinfo.fline[taginfo.fields.line] = taginfo
|
||||
call add(fileinfo.tags, taginfo)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
@@ -2255,7 +2257,9 @@ function! s:ParseTagline(part1, part2, typeinfo, fileinfo) abort
|
||||
" When splitting fields make sure not to create empty keys or values in
|
||||
" case a value illegally contains tabs
|
||||
let fields = split(a:part2, '^\t\|\t\ze\w\+:')
|
||||
let taginfo.fields.kind = remove(fields, 0)
|
||||
if fields[0] !~# ':'
|
||||
let taginfo.fields.kind = remove(fields, 0)
|
||||
endif
|
||||
for field in fields
|
||||
" can't use split() since the value can contain ':'
|
||||
let delimit = stridx(field, ':')
|
||||
@@ -2283,6 +2287,16 @@ function! s:ParseTagline(part1, part2, typeinfo, fileinfo) abort
|
||||
let taginfo.fields.line = 0
|
||||
endif
|
||||
|
||||
if !has_key(taginfo.fields, 'kind')
|
||||
call s:debug("Warning: No 'kind' field found for tag " . basic_info[0] . "!")
|
||||
if index(s:warnings.type, a:typeinfo.ftype) == -1
|
||||
call s:warning("No 'kind' field found for tag " . basic_info[0] . "!" .
|
||||
\ " Please read the last section of ':help tagbar-extend'.")
|
||||
call add(s:warnings.type, a:typeinfo.ftype)
|
||||
endif
|
||||
return {}
|
||||
endif
|
||||
|
||||
" Make some information easier accessible
|
||||
if has_key(a:typeinfo, 'scope2kind')
|
||||
for scope in keys(a:typeinfo.scope2kind)
|
||||
@@ -2314,6 +2328,7 @@ function! s:ParseTagline(part1, part2, typeinfo, fileinfo) abort
|
||||
\ ' Please read '':help tagbar-extend''.')
|
||||
call add(s:warnings.type, a:typeinfo.ftype)
|
||||
endif
|
||||
return {}
|
||||
endtry
|
||||
|
||||
return taginfo
|
||||
|
||||
Reference in New Issue
Block a user