Mercurial > vim-gutentags
changeset 199:f7a417234dea
Simplify call sites for `add_progress`, fix bugs with the progress tracking.
- `add_progress` makes paths absolute itself instead of the call sites.
- `inprogress` debug function properly prints what's going on.
- status line function shows which modules are indexing.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 27 Jul 2017 23:08:18 -0700 |
parents | 5fb056a9eefb |
children | 06c496e010b4 |
files | autoload/gutentags.vim autoload/gutentags/cscope.vim autoload/gutentags/ctags.vim autoload/gutentags/gtags_cscope.vim |
diffstat | 4 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/autoload/gutentags.vim Thu Jul 27 22:38:02 2017 -0700 +++ b/autoload/gutentags.vim Thu Jul 27 23:08:18 2017 -0700 @@ -311,7 +311,8 @@ " Make a given file known as being currently generated or updated. function! gutentags#add_progress(module, file) abort - let s:maybe_in_progress[a:module][a:file] = localtime() + let l:abs_file = fnamemodify(a:file, ':p') + let s:maybe_in_progress[a:module][l:abs_file] = localtime() endfunction " Get how to execute an external command depending on debug settings. @@ -463,8 +464,10 @@ function! gutentags#inprogress() echom "gutentags: generations in progress:" - for mip in keys(s:maybe_in_progress) - echom mip + for mod_name in keys(s:maybe_in_progress) + for mib in keys(s:maybe_in_progress[mod_name]) + echom mod_name.": ".mib + endfor endfor echom "" endfunction @@ -505,7 +508,7 @@ let l:progress_queue = s:maybe_in_progress[module] let l:timestamp = get(l:progress_queue, l:abs_tag_file) if l:timestamp == 0 - return '' + continue endif " It's maybe generating! Check if the lock file is still there... but " don't do it too soon after the script was originally launched, because @@ -514,19 +517,21 @@ if (localtime() - l:timestamp) > 1 && \!filereadable(l:abs_tag_file . '.lock') call remove(l:progress_queue, l:abs_tag_file) - return '' + continue endif call add(l:modules_in_progress, module) endfor + if len(l:modules_in_progress) == 0 + return '' + endif + " It's still there! So probably `ctags` is still running... " (although there's a chance it crashed, or the script had a problem, and " the lock file has been left behind... we could try and run some " additional checks here to see if it's legitimately running, and " otherwise delete the lock file... maybe in the future...) - if len(g:gutentags_modules) > 1 - let l:gen_msg .= '['.join(l:modules_in_progress, ',').']' - endif + let l:gen_msg .= '['.join(l:modules_in_progress, ',').']' return l:gen_msg endfunction
--- a/autoload/gutentags/cscope.vim Thu Jul 27 22:38:02 2017 -0700 +++ b/autoload/gutentags/cscope.vim Thu Jul 27 23:08:18 2017 -0700 @@ -93,8 +93,7 @@ let job_id = jobstart(job_cmd, job_dict) endif - let l:full_scopedb_file = fnamemodify(a:tags_file, ':p') - call gutentags#add_progress('cscope', l:full_scopedb_file) + call gutentags#add_progress('cscope', a:tags_file) else call gutentags#trace("(fake... not actually running)") endif
--- a/autoload/gutentags/ctags.vim Thu Jul 27 22:38:02 2017 -0700 +++ b/autoload/gutentags/ctags.vim Thu Jul 27 23:08:18 2017 -0700 @@ -179,8 +179,7 @@ endif " Flag this tags file as being in progress - let l:full_tags_file = fnamemodify(a:tags_file, ':p') - call gutentags#add_progress('ctags', l:full_tags_file) + call gutentags#add_progress('ctags', a:tags_file) else call gutentags#trace("(fake... not actually running)") endif
--- a/autoload/gutentags/gtags_cscope.vim Thu Jul 27 22:38:02 2017 -0700 +++ b/autoload/gutentags/gtags_cscope.vim Thu Jul 27 23:08:18 2017 -0700 @@ -177,8 +177,7 @@ endif endif - let l:full_gtags_file = fnamemodify(l:db_path, ':p') - call gutentags#add_progress('gtags_cscope', a:db_file) + call gutentags#add_progress('gtags_cscope', l:db_path) else call gutentags#trace("(fake... not actually running)") endif