1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00:04 +08:00

Add signatures

This commit is contained in:
wsdjeg 2017-11-28 20:40:10 +08:00
parent 7db6faed6c
commit eed5c0a46e
2 changed files with 25 additions and 17 deletions

View File

@ -43,33 +43,39 @@ function! SpaceVim#layers#checkers#config() abort
if g:spacevim_enable_ale if g:spacevim_enable_ale
autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1) autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1)
endif endif
autocmd CursorHold * call <SID>signatures_current_error() autocmd CursorMoved * call <SID>cursor_move_delay()
autocmd CursorMoved * call <SID>signatures_clear()
augroup END augroup END
let g:neomake_echo_current_error = 0 endfunction
function! s:cursor_move_delay() abort
if exists('s:cursormoved_timer')
call timer_stop(s:cursormoved_timer)
endif
let s:cursormoved_timer = timer_start(get(g:, 'neomake_cursormoved_delay', 100), function('s:signatures_current_error'))
endfunction endfunction
let s:last_echoed_error = '' let s:last_echoed_error = ''
let s:clv = &conceallevel let s:clv = &conceallevel
function! s:signatures_current_error() abort function! s:signatures_current_error(...) abort
let message = neomake#GetCurrentErrorMsg() call s:signatures_clear()
if empty(message) let message = neomake#GetCurrentErrorMsg()
if exists('s:last_echoed_error') if empty(message)
echon ''
unlet s:last_echoed_error
endif
return
endif
if exists('s:last_echoed_error') if exists('s:last_echoed_error')
\ && s:last_echoed_error == message unlet s:last_echoed_error
return
endif endif
let s:last_echoed_error = message return
set conceallevel=2 endif
call s:SIG.info(line('.') + 1, col('.'), message) if exists('s:last_echoed_error')
\ && s:last_echoed_error == message
return
endif
let s:last_echoed_error = message
set conceallevel=2
call s:SIG.info(line('.') + 1, col('.'), message)
endfunction endfunction
function! s:signatures_clear() abort function! s:signatures_clear() abort
let s:last_echoed_error = ''
let &conceallevel = s:clv let &conceallevel = s:clv
call s:SIG.clear() call s:SIG.clear()
endfunction endfunction

View File

@ -4,6 +4,8 @@ if get(g:, 'spacevim_lint_on_save', 0)
let s:neomake_automake_events['BufWritePost'] = {'delay': 0} let s:neomake_automake_events['BufWritePost'] = {'delay': 0}
endif endif
let g:neomake_echo_current_error = 0
if get(g:, 'spacevim_lint_on_the_fly', 0) if get(g:, 'spacevim_lint_on_the_fly', 0)
let s:neomake_automake_events['TextChanged'] = {'delay': 750} let s:neomake_automake_events['TextChanged'] = {'delay': 750}
let s:neomake_automake_events['TextChangedI'] = {'delay': 750} let s:neomake_automake_events['TextChangedI'] = {'delay': 750}