Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated instance of a-sync call for tagbar originally implemented by @pangchol #663

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion autoload/tagbar.vim
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2646,13 +2646,26 @@ endfunction

" Helper functions {{{1
" s:AutoUpdate() {{{2
" use timer_start to let tagbar async, this can increase vim open file performance and
" fix windows blink when open some file.
function! s:AutoUpdate(fname, force, ...) abort
call tagbar#debug#log('AutoUpdate called [' . a:fname . ']')

" Whether we want to skip actually displaying the tags in Tagbar and only
" update the fileinfo
let no_display = a:0 > 0 ? a:1 : 0

if !has('win32') && has('lambda') && has('timers')
call tagbar#debug#log('Performing async call to AutoUpdate_CB')
call timer_start(0, { -> AutoUpdate_CB(a:fname, a:force, no_display)})
else
call tagbar#debug#log('Performing sync call to AutoUpdate_CB')
call AutoUpdate_CB(a:fname, a:force, no_display)
endif
endfunc

function! AutoUpdate_CB(fname, force, no_display) abort

" This file is being loaded due to a quickfix command like vimgrep, so
" don't process it
if exists('s:tagbar_qf_active')
Expand Down Expand Up @@ -2713,7 +2726,7 @@ function! s:AutoUpdate(fname, force, ...) abort
let updated = 1
endif

if no_display
if a:no_display
return
endif

Expand Down