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

suggest let s:AutoUpdate function run async #532

Open
pangchol opened this issue Mar 29, 2019 · 1 comment · May be fixed by #663
Open

suggest let s:AutoUpdate function run async #532

pangchol opened this issue Mar 29, 2019 · 1 comment · May be fixed by #663

Comments

@pangchol
Copy link

pangchol commented Mar 29, 2019

I use tagbar to repacle taglist recently, but I find when I use vim-rtags to jump anohter file, or edist a file, if this file is open first time , the main windows screen will often refreash unnecessary. soon I find it is cause by s:AutoUpdate always jump to tagbrer windows first and then jump back
, this flow is by in sync and the " autocmd BufEnter " auto call s:AutoUpdate at the buffer not be completely ready. so I try using job_start to let s:AutoUpdate Call async and find the refreash disappear. my simple implementation like this:

function! s:AutoUpdate(fname, force, ...) abort
    let g:tagbar_update_fname = a:fname
    let g:tagbar_update_force = a:force
    let g:tagbar_no_display = a:0 > 0 ? a:1 : 0
    call job_start('sleep 0', {'close_cb':'AutoUpdate_CB'})
endfunc

function! AutoUpdate_CB(channel) abort
    " call tagbar#debug#log('AutoUpdate called [' . fname . ']')
    let fname = g:tagbar_update_fname
    let force = g:tagbar_update_force
    let no_display = g:tagbar_no_display

the AutoUpdate_CB is the old s:AutoUpdate function and just modify the three line ahead.

@alerque
Copy link
Member

alerque commented Oct 22, 2019

Thanks for noting this @pangchol. This would probably be a really good thing to include out of the box. Would you care to whip up a PR for it?

Also can anybody comment on the status of async support right now? Does this need a different command for vim vs. neovim? Do we need to check that async support is included at all? I'm guessing we might need a three way check here to implement it right: ① old vim without async, ② new vim with async, and ③ neovim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants