mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 11:30:28 +01:00
Add option to disable use of tmp file cache
This commit is contained in:
@@ -1182,29 +1182,34 @@ function! s:ProcessFile(fname, ftype) abort
|
||||
|
||||
call tagbar#debug#log('typeinfo for file to process: ' . string(typeinfo))
|
||||
|
||||
" Use a temporary files for ctags processing instead of the original one.
|
||||
" This allows using Tagbar for files accessed with netrw, and also doesn't
|
||||
" slow down Tagbar for files that sit on slow network drives.
|
||||
let tempfile = tempname()
|
||||
let ext = fnamemodify(fileinfo.fpath, ':e')
|
||||
if ext !=# ''
|
||||
let tempfile .= '.' . ext
|
||||
endif
|
||||
if g:tagbar_use_cache
|
||||
" Use a temporary files for ctags processing instead of the original one.
|
||||
" This allows using Tagbar for files accessed with netrw, and also doesn't
|
||||
" slow down Tagbar for files that sit on slow network drives.
|
||||
let tempfile = tempname()
|
||||
let ext = fnamemodify(fileinfo.fpath, ':e')
|
||||
if ext !=# ''
|
||||
let tempfile .= '.' . ext
|
||||
endif
|
||||
|
||||
call tagbar#debug#log('Caching file into: ' . tempfile)
|
||||
let templines = getbufline(fileinfo.bufnr, 1, '$')
|
||||
let res = writefile(templines, tempfile)
|
||||
call tagbar#debug#log('Caching file into: ' . tempfile)
|
||||
let templines = getbufline(fileinfo.bufnr, 1, '$')
|
||||
let res = writefile(templines, tempfile)
|
||||
|
||||
if res != 0
|
||||
call tagbar#debug#log('Could not create copy '.tempfile)
|
||||
return
|
||||
endif
|
||||
let fileinfo.mtime = getftime(tempfile)
|
||||
if res != 0
|
||||
call tagbar#debug#log('Could not create copy '.tempfile)
|
||||
return
|
||||
endif
|
||||
let fileinfo.mtime = getftime(tempfile)
|
||||
|
||||
let ctags_output = s:ExecuteCtagsOnFile(tempfile, a:fname, typeinfo)
|
||||
let ctags_output = s:ExecuteCtagsOnFile(tempfile, a:fname, typeinfo)
|
||||
|
||||
if !tagbar#debug#enabled()
|
||||
call delete(tempfile)
|
||||
if !tagbar#debug#enabled()
|
||||
call delete(tempfile)
|
||||
endif
|
||||
else
|
||||
call tagbar#debug#log('File caching disabled')
|
||||
let ctags_output = s:ExecuteCtagsOnFile(a:fname, a:fname, typeinfo)
|
||||
endif
|
||||
|
||||
if ctags_output == -1
|
||||
|
||||
Reference in New Issue
Block a user