diff --git a/bundle/git.vim/README.md b/bundle/git.vim/README.md index 281aba1fb..0f86a2b90 100644 --- a/bundle/git.vim/README.md +++ b/bundle/git.vim/README.md @@ -4,7 +4,7 @@ Use git in SpaceVim - +This plugin adds extensive support for [git](https://git-scm.com/). diff --git a/bundle/gtags.vim/autoload/ctags.vim b/bundle/gtags.vim/autoload/ctags.vim index e0bf53b5d..0305452f9 100644 --- a/bundle/gtags.vim/autoload/ctags.vim +++ b/bundle/gtags.vim/autoload/ctags.vim @@ -16,7 +16,7 @@ endif let s:LOGGER =SpaceVim#logger#derive('ctags') if !exists('g:gtags_ctags_bin') - let g:gtags_ctags_bin = 'ctags' + let g:gtags_ctags_bin = 'ctags' endif if !executable(g:gtags_ctags_bin) @@ -43,6 +43,8 @@ endfunction function! s:version_exit(id, data, event) abort if a:data ==# 0 let s:version_checked = 1 + call s:LOGGER.info('ctags version checking done:') + call s:LOGGER.info(' ctags bin:' . g:gtags_ctags_bin) call ctags#update() endif endfunction @@ -51,8 +53,8 @@ endfunction function! ctags#update(...) abort if !s:version_checked call s:JOB.start([g:gtags_ctags_bin, '--version'], { - \ 'on_stdout': funcref('s:version_std_out'), - \ 'on_exit': funcref('s:version_exit'), + \ 'on_stdout': function('s:version_std_out'), + \ 'on_exit': function('s:version_exit'), \ }) return endif @@ -65,17 +67,46 @@ function! ctags#update(...) abort let cmd += ['-G'] endif if !isdirectory(dir) - call mkdir(dir, 'p') + if !mkdir(dir, 'p') + call s:LOGGER.warn('failed to create data databases dir:' . dir) + endif endif if isdirectory(dir) let cmd += ['-R', '-o', dir . '/tags', project_root] - call s:JOB.start(cmd, {'on_exit' : funcref('s:on_update_exit')}) + call s:LOGGER.debug('ctags command:' . string(cmd)) + let jobid = s:JOB.start(cmd, { + \ 'on_stdout' : function('s:on_update_stdout'), + \ 'on_stderr' : function('s:on_update_stderr'), + \ 'on_exit' : function('s:on_update_exit') + \ }) + if jobid <= 0 + call s:LOGGER.debug('failed to start ctags job, return jobid:' . jobid) + endif endif endfunction -function! s:on_update_exit(...) abort - if str2nr(a:2) > 0 - call s:LOGGER.warn('failed to update gtags, exit data: ' . a:2) +function! s:on_update_stdout(id, data, event) abort + for line in a:data + call s:LOGGER.debug('stdout' . line) + endfor +endfunction + +function! s:on_update_stderr(id, data, event) abort + for line in a:data + call s:LOGGER.debug('stderr' . line) + endfor +endfunction + +function! s:on_update_exit(id, data, event) abort + " @bug on exit function is not called when failed + " C:\Users\wsdjeg\.SpaceVim>C:\Users\wsdjeg\.SpaceVim\bundle\phpcomplete.vim\bin\ctags.exe -R -o C:/Users/wsdjeg/.cache/SpaceVim/tags/C__Users_wsd + " jeg__SpaceVim_/tags C:\Users\wsdjeg\.SpaceVim + " + " C:\Users\wsdjeg\.SpaceVim>echo %ERRORLEVEL% + " -1073741819 + " https://github.com/neovim/neovim/issues/20856 + if a:data != 0 + call s:LOGGER.warn('failed to update gtags, exit data: ' . a:data) else call s:LOGGER.info('ctags database updated successfully') endif diff --git a/bundle/gtags.vim/autoload/gtags.vim b/bundle/gtags.vim/autoload/gtags.vim index bad10dcb7..7ad81cc53 100644 --- a/bundle/gtags.vim/autoload/gtags.vim +++ b/bundle/gtags.vim/autoload/gtags.vim @@ -477,9 +477,9 @@ function! gtags#update(single_update) abort call s:JOB.start(cmd, {'on_exit' : funcref('s:on_update_exit')}) endfunction -function! s:on_update_exit(...) abort - if str2nr(a:2) > 0 && !g:gtags_silent - call s:LOGGER.warn('failed to update gtags, exit data: ' . a:2) +function! s:on_update_exit(id, data, event) abort + if a:data > 0 && !g:gtags_silent + call s:LOGGER.warn('failed to update gtags, exit data: ' . a:data) endif endfunction