From 251c7744315b0ec8d14ea73258c09ad8cb205605 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Mon, 27 Oct 2014 22:37:17 +1300 Subject: [PATCH] Don't assume all types define 'ctagstype' --- autoload/tagbar.vim | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 8901efc..3dd0e82 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -2156,15 +2156,18 @@ function! s:ExecuteCtagsOnFile(fname, realfname, typeinfo) abort let ctags_args += ['--options=' . expand(a:typeinfo.deffile)] endif - let ctags_type = a:typeinfo.ctagstype + " Third-party programs may not necessarily make use of this + if has_key(a:typeinfo, 'ctagstype') + let ctags_type = a:typeinfo.ctagstype - let ctags_kinds = '' - for kind in a:typeinfo.kinds - let ctags_kinds .= kind.short - endfor + let ctags_kinds = '' + for kind in a:typeinfo.kinds + let ctags_kinds .= kind.short + endfor - let ctags_args += ['--language-force=' . ctags_type] - let ctags_args += ['--' . ctags_type . '-kinds=' . ctags_kinds] + let ctags_args += ['--language-force=' . ctags_type] + let ctags_args += ['--' . ctags_type . '-kinds=' . ctags_kinds] + endif endif if has_key(a:typeinfo, 'ctagsbin')