Better handling for typeinfo.deffile (#777)

Closes #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.
This commit is contained in:
David Hegland 2021-06-24 09:37:26 -05:00 committed by GitHub
parent 285afffc47
commit 2da3443f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
@ -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')