From 5283bc834a8c39b058d5eef1173e323b23b04fa0 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Sun, 2 Nov 2014 17:44:25 +1300 Subject: [PATCH] Reprocess files if filetype changes, closes #228 --- autoload/tagbar.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 8a0fedf..299ea63 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -2006,7 +2006,8 @@ function! s:ProcessFile(fname, ftype) abort " If the file has only been updated preserve the fold states, otherwise " create a new entry - if s:known_files.has(a:fname) && !empty(s:known_files.get(a:fname)) + if s:known_files.has(a:fname) && !empty(s:known_files.get(a:fname)) && + \ s:known_files.get(a:fname).ftype == a:ftype let fileinfo = s:known_files.get(a:fname) let typeinfo = fileinfo.typeinfo call fileinfo.reset() @@ -3334,7 +3335,7 @@ function! s:AutoUpdate(fname, force) abort if s:known_files.has(a:fname) let curfile = s:known_files.get(a:fname) " if a:force || getbufvar(curfile.bufnr, '&modified') || - if a:force || empty(curfile) || + if a:force || empty(curfile) || curfile.ftype != sftype || \ (filereadable(a:fname) && getftime(a:fname) > curfile.mtime) call s:debug('File data outdated, updating [' . a:fname . ']') call s:ProcessFile(a:fname, sftype)