mirror of
https://github.com/ludovicchabant/vim-gutentags.git
synced 2024-11-23 22:42:39 +08:00
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.
This commit is contained in:
parent
7b155a4ce2
commit
b948a814e0
|
@ -311,7 +311,8 @@ endfor
|
|||
|
||||
" 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 @@ endfunction
|
|||
|
||||
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 @@ function! gutentags#statusline(...) abort
|
|||
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 @@ function! gutentags#statusline(...) abort
|
|||
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
|
||||
|
||||
|
|
|
@ -93,8 +93,7 @@ function! gutentags#cscope#generate(proj_dir, tags_file, write_mode) abort
|
|||
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
|
||||
|
|
|
@ -179,8 +179,7 @@ function! gutentags#ctags#generate(proj_dir, tags_file, write_mode) abort
|
|||
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
|
||||
|
|
|
@ -177,8 +177,7 @@ function! gutentags#gtags_cscope#generate(proj_dir, db_file, write_mode) abort
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user