Skip to content

Commit

Permalink
Deprecate ALEGetError and ALEGetWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu committed Oct 26, 2017
1 parent a58cbb0 commit 3e7e463
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ let g:space_vim_dark_background = 234

### `Layers()`

Please refer to [LAYERS](layers/LAYERS.md) to take a look at the whole shipped layers.
Please refer to [LAYERS.md](layers/LAYERS.md) to take a look at the whole shipped layers.

```vim
" Enable the existing layers in space-vim
Expand Down
27 changes: 27 additions & 0 deletions core/autoload/spacevim/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,30 @@ function! spacevim#util#GotoJump()
endif
endif
endfunction

" [DEPRECATED] ALE statusline integration
function! spacevim#util#ALEGetError()
let l:res = ale#statusline#Status()
if l:res ==# 'OK'
return ''
else
let l:e_w = split(l:res)
if len(l:e_w) == 2 || match(l:e_w, 'E') > -1
return '' . matchstr(l:e_w[0], '\d\+') .' '
endif
endif
endfunction

function! spacevim#util#ALEGetWarning()
let l:res = ale#statusline#Status()
if l:res ==# 'OK'
return ''
else
let l:e_w = split(l:res)
if len(l:e_w) == 2
return '' . matchstr(l:e_w[1], '\d\+')
elseif match(l:e_w, 'W') > -1
return '' . matchstr(l:e_w[0], '\d\+')
endif
endif
endfunction
36 changes: 9 additions & 27 deletions layers/+checkers/syntax-checking/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,6 @@ if g:spacevim_vim8 || g:spacevim_nvim
let g:ale_echo_msg_format = '[#%linter%#] %s [%severity%]'
let g:ale_statusline_format = ['E•%d', 'W•%d', 'OK']

" For a more fancy ale statusline
function! ALEGetError()
let l:res = ale#statusline#Status()
if l:res ==# 'OK'
return ''
else
let l:e_w = split(l:res)
if len(l:e_w) == 2 || match(l:e_w, 'E') > -1
return '' . matchstr(l:e_w[0], '\d\+') .' '
endif
endif
endfunction

function! ALEGetWarning()
let l:res = ale#statusline#Status()
if l:res ==# 'OK'
return ''
else
let l:e_w = split(l:res)
if len(l:e_w) == 2
return '' . matchstr(l:e_w[1], '\d\+')
elseif match(l:e_w, 'W') > -1
return '' . matchstr(l:e_w[0], '\d\+')
endif
endif
endfunction

if g:spacevim_gui
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_warning_str = 'Warning'
Expand All @@ -62,6 +35,15 @@ if g:spacevim_vim8 || g:spacevim_nvim
nmap <Leader>en <Plug>(ale_next)
nmap <Leader>ep <Plug>(ale_previous)
nnoremap <Leader>ts :ALEToggle<CR>
" [DEPRECATED] Use ale#statusline#Count(buffer) instead
" For a more fancy ale statusline
function! ALEGetError()
return spacevim#util#ALEGetError()
endfunction
function! ALEGetWarning()
return spacevim#util#ALEGetWarning()
endfunction
" }
else
" syntastic {
Expand Down

0 comments on commit 3e7e463

Please sign in to comment.