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

Fix checkers layer

Fix an issue layer option show_cursor_error won't work. Show error
message in command line if show_cursor_error is off. Show warning
message if show_cursor_error were set to on without timer feature.
This commit is contained in:
Seong Yong-ju 2018-02-01 23:25:42 +09:00
parent bb980c32ec
commit f6bb955989
2 changed files with 14 additions and 3 deletions

View File

@ -20,16 +20,29 @@ function! SpaceVim#layers#checkers#plugins() abort
return plugins return plugins
endfunction endfunction
let s:show_cursor_error = 1
function! SpaceVim#layers#checkers#set_variable(var) abort function! SpaceVim#layers#checkers#set_variable(var) abort
let s:show_cursor_error = get(a:var, 'show_cursor_error', 1) let s:show_cursor_error = get(a:var, 'show_cursor_error', 1)
if s:show_cursor_error && !has('timer')
call SpaceVim#logger#warn('show_cursor_error in checkers layer needs timer feature')
let s:show_cursor_error = 0
endif
endfunction endfunction
function! SpaceVim#layers#checkers#config() abort function! SpaceVim#layers#checkers#config() abort
"" neomake/neomake {{{
" This setting will echo the error for the line your cursor is on, if any.
let g:neomake_echo_current_error = get(g:, 'neomake_echo_current_error', !s:show_cursor_error)
let g:neomake_cursormoved_delay = get(g:, 'neomake_cursormoved_delay', 300) let g:neomake_cursormoved_delay = get(g:, 'neomake_cursormoved_delay', 300)
"" }}}
"" w0rp/ale {{{
let g:ale_echo_delay = get(g:, 'ale_echo_delay', 300) let g:ale_echo_delay = get(g:, 'ale_echo_delay', 300)
"" }}}
call SpaceVim#mapping#space#def('nnoremap', ['e', 'c'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['e', 'c'], 'call call('
\ . string(s:_function('s:clear_errors')) . ', [])', \ . string(s:_function('s:clear_errors')) . ', [])',
@ -55,7 +68,7 @@ function! SpaceVim#layers#checkers#config() abort
if g:spacevim_enable_neomake if g:spacevim_enable_neomake
autocmd User NeomakeFinished nested autocmd User NeomakeFinished nested
\ let &l:statusline = SpaceVim#layers#core#statusline#get(1) \ let &l:statusline = SpaceVim#layers#core#statusline#get(1)
if has('timers') if s:show_cursor_error
" when move cursor, the error message will be shown below current line " when move cursor, the error message will be shown below current line
" after a delay " after a delay
autocmd CursorMoved * call <SID>neomake_cursor_move_delay() autocmd CursorMoved * call <SID>neomake_cursor_move_delay()

View File

@ -4,8 +4,6 @@ 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}