mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-13 02:05:40 +08:00
fix(tags): fix ctags/gtags exit function
This commit is contained in:
parent
814c9a6e3c
commit
c25c711d50
2
bundle/git.vim/README.md
vendored
2
bundle/git.vim/README.md
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
Use git in SpaceVim
|
||||
|
||||
|
||||
This plugin adds extensive support for [git](https://git-scm.com/).
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
|
47
bundle/gtags.vim/autoload/ctags.vim
vendored
47
bundle/gtags.vim/autoload/ctags.vim
vendored
@ -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
|
||||
|
6
bundle/gtags.vim/autoload/gtags.vim
vendored
6
bundle/gtags.vim/autoload/gtags.vim
vendored
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user