mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 11:30:28 +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
|
||||
|
||||
@@ -1202,10 +1202,11 @@ imporant tips to get it to integrate well with Tagbar:
|
||||
(stdout), it doesn't generate files and reads them in after that. So make
|
||||
sure that your program has an option to output the tags on stdout.
|
||||
- Some fields are supported for providing additional information about a
|
||||
tag. One field is required: the "kind" field as a single letter without
|
||||
a "kind:" fieldname. This field has to be the first one in the list. All
|
||||
other fields need to have a fieldname in order to determine what they are.
|
||||
The following fields are supported for all filetypes:
|
||||
tag. One field is required: the "kind" field as a single letter, either
|
||||
with or without a "kind:" fieldname. If it is used without the fieldname
|
||||
then it has to be the first field in the list. All other fields need to
|
||||
have a fieldname in order to determine what they are. The following fields
|
||||
are supported for all filetypes:
|
||||
|
||||
* line: The line number of the tag.
|
||||
* column: The column number of the tag.
|
||||
|
||||
Reference in New Issue
Block a user