1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-09 09:30:04 +08:00

perf(tagbar): use tagbar logger for warning msg

This commit is contained in:
wsdjeg 2023-06-14 22:25:29 +08:00
parent c2e4697ed7
commit 53e568dab3
3 changed files with 12 additions and 15 deletions

View File

@ -29,7 +29,7 @@ if exists(':Tagbar') == 0
endif endif
if exists(':Tagbar') == 0 if exists(':Tagbar') == 0
echomsg 'Tagbar: Could not load plugin code, check your runtimepath!' call tagbar#log#warn('Could not load plugin code, check your runtimepath!')
finish finish
endif endif
@ -39,7 +39,7 @@ redir => s:ftype_out
silent filetype silent filetype
redir END redir END
if s:ftype_out !~# 'detection:ON' if s:ftype_out !~# 'detection:ON'
echomsg 'Tagbar: Filetype detection is turned off, skipping plugin' call tagbar#log#warn('Filetype detection is turned off, skipping plugin')
unlet s:ftype_out unlet s:ftype_out
finish finish
endif endif

View File

@ -32,6 +32,12 @@ function! tagbar#log#info(msg) abort
call s:LOGGER.info(a:msg) call s:LOGGER.info(a:msg)
endfunction endfunction
function! tagbar#log#warn(msg) abort
call s:LOGGER.warn(a:msg)
endfunction
function! tagbar#log#debug_enabled() abort function! tagbar#log#debug_enabled() abort
return s:LOGGER.debug_enabled() return s:LOGGER.debug_enabled()
endfunction endfunction

View File

@ -27,18 +27,14 @@ endif
" Basic init {{{1 " Basic init {{{1
if v:version < 700 if v:version < 700
echohl WarningMsg call tagbar#log#warn('Vim version is too old, Tagbar requires at least 7.0')
echomsg 'Tagbar: Vim version is too old, Tagbar requires at least 7.0'
echohl None
finish finish
endif endif
if v:version == 700 && !has('patch167') if v:version == 700 && !has('patch167')
echohl WarningMsg call tagbar#log#warn('Vim versions lower than 7.0.167 have a bug')
echomsg 'Tagbar: Vim versions lower than 7.0.167 have a bug' call tagbar#log#warn('that prevents this version of Tagbar from working.')
\ 'that prevents this version of Tagbar from working.' call tagbar#log#warn('Please use the alternate version posted on the website.')
\ 'Please use the alternate version posted on the website.'
echohl None
finish finish
endif endif
@ -183,7 +179,6 @@ augroup TagbarSession
autocmd SessionLoadPost * nested call tagbar#RestoreSession() autocmd SessionLoadPost * nested call tagbar#RestoreSession()
augroup END augroup END
" Commands {{{1
command! -nargs=? Tagbar call tagbar#ToggleWindow(<f-args>) command! -nargs=? Tagbar call tagbar#ToggleWindow(<f-args>)
command! -nargs=? TagbarToggle call tagbar#ToggleWindow(<f-args>) command! -nargs=? TagbarToggle call tagbar#ToggleWindow(<f-args>)
command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>) command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>)
@ -200,7 +195,3 @@ command! -nargs=0 TagbarForceUpdate call tagbar#ForceUpdate()
command! -nargs=0 TagbarJump call tagbar#jump() command! -nargs=0 TagbarJump call tagbar#jump()
command! -nargs=0 TagbarJumpPrev call tagbar#jumpToNearbyTag(-1) command! -nargs=0 TagbarJumpPrev call tagbar#jumpToNearbyTag(-1)
command! -nargs=0 TagbarJumpNext call tagbar#jumpToNearbyTag(1) command! -nargs=0 TagbarJumpNext call tagbar#jumpToNearbyTag(1)
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1