add eclim's checker extension, when eclim is running , it can instead of syntastic

This commit is contained in:
xinleibird 2013-10-01 12:42:42 +08:00
parent e16c36eea1
commit 5582daf79c
5 changed files with 40 additions and 3 deletions

View File

@ -19,6 +19,7 @@ function! airline#deprecation#check()
\ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ], \ [ 'g:airline_enable_branch', 'g:airline#extensions#branch#enabled' ],
\ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ], \ [ 'g:airline_enable_bufferline', 'g:airline#extensions#bufferline#enabled' ],
\ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ], \ [ 'g:airline_enable_syntastic', 'g:airline#extensions#syntastic#enabled' ],
\ [ 'g:airline_enable_eclim', 'g:airline#extensions#eclim#enabled' ],
\ ] \ ]
for test in tests for test in tests
if exists(test[0]) if exists(test[0])

View File

@ -181,8 +181,13 @@ function! airline#extensions#load()
call airline#extensions#virtualenv#init(s:ext) call airline#extensions#virtualenv#init(s:ext)
endif endif
if (get(g:, 'airline#extensions#eclim#enabled', 1) && get(g:, 'airline_enable_eclim', 1))
\ && exists(':ProjectCreate')
call airline#extensions#eclim#init(s:ext)
endif
if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1)) if (get(g:, 'airline#extensions#syntastic#enabled', 1) && get(g:, 'airline_enable_syntastic', 1))
\ && exists(':SyntasticCheck') \ && exists(':SyntasticCheck') && !exists('g:eclim_instead_syntastic')
call airline#extensions#syntastic#init(s:ext) call airline#extensions#syntastic#init(s:ext)
endif endif

View File

@ -0,0 +1,30 @@
" MIT License. Copyright (c) 2013 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
"if !exists('g:eclim_instead_syntastic')
"let g:eclim_instead_syntastic = 0
"endif
"if g:eclim_instead_syntastic == 1
"finish
"endif
if !exists(':ProjectCreate')
finish
endif
function! airline#extensions#eclim#get_warnings()
let eclimList = eclim#display#signs#GetExisting()
if !empty(eclimList)
let errorsLine = eclimList[0]['line']
let errorsNumber = len(eclimList)
let errors = "[Warring: line:".string(errorsLine)." (".string(errorsNumber).")]"
return errors.(g:airline_symbols.space)
endif
return ''
endfunction
function! airline#extensions#eclim#init(ext)
if !exists('g:eclim_instead_syntastic')
let g:eclim_instead_syntastic = 1
endif
call airline#parts#define_function('eclim', 'airline#extensions#eclim#get_warnings')
endfunction

View File

@ -78,7 +78,7 @@ function! airline#init#bootstrap()
call airline#parts#define_raw('file', '%f%m') call airline#parts#define_raw('file', '%f%m')
call airline#parts#define_raw('linenr', (g:airline_symbols.linenr).'%#__accent_bold#%4l%#__restore__#') call airline#parts#define_raw('linenr', (g:airline_symbols.linenr).'%#__accent_bold#%4l%#__restore__#')
call airline#parts#define_function('ffenc', 'airline#parts#ffenc') call airline#parts#define_function('ffenc', 'airline#parts#ffenc')
call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'whitespace']) call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace'])
unlet g:airline#init#bootstrapping unlet g:airline#init#bootstrapping
endfunction endfunction
@ -107,7 +107,7 @@ function! airline#init#sections()
let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c ']) let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c '])
endif endif
if !exists('g:airline_section_warning') if !exists('g:airline_section_warning')
let g:airline_section_warning = airline#section#create(['syntastic', 'whitespace']) let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace'])
endif endif
endfunction endfunction

View File

@ -62,6 +62,7 @@ describe 'init sections'
Expect airline#parts#get('branch').raw == '' Expect airline#parts#get('branch').raw == ''
Expect airline#parts#get('tagbar').raw == '' Expect airline#parts#get('tagbar').raw == ''
Expect airline#parts#get('syntastic').raw == '' Expect airline#parts#get('syntastic').raw == ''
Expect airline#parts#get('eclim').raw == ''
Expect airline#parts#get('whitespace').raw == '' Expect airline#parts#get('whitespace').raw == ''
end end
end end