Skip to content

Commit

Permalink
Better handling for typeinfo.deffile (preservim#777)
Browse files Browse the repository at this point in the history
Closes preservim#776

Change the ordering of the --options field when executing ctags. This
allows overrides of things like the --<lang>-kinds definitions to omit
certain kinds.

Also add check to ensure the typeinfo.deffile exists before attempting
to use it in the ctags arguments.
  • Loading branch information
dev-hann committed Jun 24, 2021
1 parent 13dfeb2 commit d094c89
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions autoload/tagbar.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1390,11 +1390,6 @@ function! s:ExecuteCtagsOnFile(fname, realfname, typeinfo) abort
let ctags_args += [ '-V' ]
endif

" Include extra type definitions
if has_key(a:typeinfo, 'deffile')
let ctags_args += ['--options=' . expand(a:typeinfo.deffile)]
endif

" Third-party programs may not necessarily make use of this
if has_key(a:typeinfo, 'ctagstype')
let ctags_type = a:typeinfo.ctagstype
Expand All @@ -1409,6 +1404,12 @@ function! s:ExecuteCtagsOnFile(fname, realfname, typeinfo) abort
let ctags_args += ['--language-force=' . ctags_type]
let ctags_args += ['--' . ctags_type . '-kinds=' . ctags_kinds]
endif

" Include extra type definitions - include last to allow for any
" overrides
if has_key(a:typeinfo, 'deffile') && filereadable(expand(a:typeinfo.deffile))
let ctags_args += ['--options=' . expand(a:typeinfo.deffile)]
endif
endif

if has_key(a:typeinfo, 'ctagsbin')
Expand Down

0 comments on commit d094c89

Please sign in to comment.