1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:20:05 +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
autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1)
endif
autocmd CursorHold * call <SID>signatures_current_error()
autocmd CursorMoved * call <SID>signatures_clear()
autocmd CursorMoved * call <SID>cursor_move_delay()
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
let s:last_echoed_error = ''
let s:clv = &conceallevel
function! s:signatures_current_error() abort
let message = neomake#GetCurrentErrorMsg()
if empty(message)
if exists('s:last_echoed_error')
echon ''
unlet s:last_echoed_error
endif
return
endif
function! s:signatures_current_error(...) abort
call s:signatures_clear()
let message = neomake#GetCurrentErrorMsg()
if empty(message)
if exists('s:last_echoed_error')
\ && s:last_echoed_error == message
return
unlet s:last_echoed_error
endif
let s:last_echoed_error = message
set conceallevel=2
call s:SIG.info(line('.') + 1, col('.'), message)
return
endif
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
function! s:signatures_clear() abort
let s:last_echoed_error = ''
let &conceallevel = s:clv
call s:SIG.clear()
endfunction

View File

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