From 35ee5a91f9f4980effa6994358ea131f530440d1 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sat, 10 Sep 2016 20:57:37 +1200 Subject: [PATCH] Fix Python member functions with Universal Ctags, closes #306 --- autoload/tagbar.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 34e3f48..d876de1 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -55,6 +55,7 @@ let s:statusline_in_use = 0 " 0: not checked yet; 1: checked and found; 2: checked and not found let s:checked_ctags = 0 let s:checked_ctags_types = 0 +let s:ctags_is_uctags = 0 let s:ctags_types = {} let s:new_window = 1 @@ -565,6 +566,12 @@ function! s:InitTypes() abort \ 'class' : 'c', \ 'function' : 'f' \ } + if s:ctags_is_uctags + " Universal Ctags treats member functions differently from normal + " functions + let type_python.kind2scope.m = 'member' + let type_python.scope2kind.member = 'm' + endif let s:known_types.python = type_python let s:known_types.pyrex = type_python let s:known_types.cython = type_python @@ -1143,13 +1150,14 @@ endfunction function! s:CheckExCtagsVersion(output) abort call s:debug('Checking Exuberant Ctags version') - if a:output =~ 'Exuberant Ctags Development' - call s:debug("Found development version, assuming compatibility") + if a:output =~ 'Universal Ctags' + call s:debug("Found Universal Ctags, assuming compatibility") + let s:ctags_is_uctags = 1 return 1 endif - if a:output =~ 'Universal Ctags' - call s:debug("Found Universal Ctags, assuming compatibility") + if a:output =~ 'Exuberant Ctags Development' + call s:debug("Found development version, assuming compatibility") return 1 endif