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
|
Use git in SpaceVim
|
||||||
|
|
||||||
|
This plugin adds extensive support for [git](https://git-scm.com/).
|
||||||
|
|
||||||
<!-- vim-markdown-toc GFM -->
|
<!-- 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')
|
let s:LOGGER =SpaceVim#logger#derive('ctags')
|
||||||
|
|
||||||
if !exists('g:gtags_ctags_bin')
|
if !exists('g:gtags_ctags_bin')
|
||||||
let g:gtags_ctags_bin = 'ctags'
|
let g:gtags_ctags_bin = 'ctags'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !executable(g:gtags_ctags_bin)
|
if !executable(g:gtags_ctags_bin)
|
||||||
@ -43,6 +43,8 @@ endfunction
|
|||||||
function! s:version_exit(id, data, event) abort
|
function! s:version_exit(id, data, event) abort
|
||||||
if a:data ==# 0
|
if a:data ==# 0
|
||||||
let s:version_checked = 1
|
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()
|
call ctags#update()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -51,8 +53,8 @@ endfunction
|
|||||||
function! ctags#update(...) abort
|
function! ctags#update(...) abort
|
||||||
if !s:version_checked
|
if !s:version_checked
|
||||||
call s:JOB.start([g:gtags_ctags_bin, '--version'], {
|
call s:JOB.start([g:gtags_ctags_bin, '--version'], {
|
||||||
\ 'on_stdout': funcref('s:version_std_out'),
|
\ 'on_stdout': function('s:version_std_out'),
|
||||||
\ 'on_exit': funcref('s:version_exit'),
|
\ 'on_exit': function('s:version_exit'),
|
||||||
\ })
|
\ })
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@ -65,17 +67,46 @@ function! ctags#update(...) abort
|
|||||||
let cmd += ['-G']
|
let cmd += ['-G']
|
||||||
endif
|
endif
|
||||||
if !isdirectory(dir)
|
if !isdirectory(dir)
|
||||||
call mkdir(dir, 'p')
|
if !mkdir(dir, 'p')
|
||||||
|
call s:LOGGER.warn('failed to create data databases dir:' . dir)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
if isdirectory(dir)
|
if isdirectory(dir)
|
||||||
let cmd += ['-R', '-o', dir . '/tags', project_root]
|
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
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_update_exit(...) abort
|
function! s:on_update_stdout(id, data, event) abort
|
||||||
if str2nr(a:2) > 0
|
for line in a:data
|
||||||
call s:LOGGER.warn('failed to update gtags, exit data: ' . a:2)
|
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
|
else
|
||||||
call s:LOGGER.info('ctags database updated successfully')
|
call s:LOGGER.info('ctags database updated successfully')
|
||||||
endif
|
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')})
|
call s:JOB.start(cmd, {'on_exit' : funcref('s:on_update_exit')})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:on_update_exit(...) abort
|
function! s:on_update_exit(id, data, event) abort
|
||||||
if str2nr(a:2) > 0 && !g:gtags_silent
|
if a:data > 0 && !g:gtags_silent
|
||||||
call s:LOGGER.warn('failed to update gtags, exit data: ' . a:2)
|
call s:LOGGER.warn('failed to update gtags, exit data: ' . a:data)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user