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

Update sig api

This commit is contained in:
wsdjeg 2017-11-28 10:39:47 +08:00
parent 8679409af1
commit 7db6faed6c
2 changed files with 39 additions and 3 deletions

View File

@ -1,7 +1,10 @@
let s:self = {}
let s:self.id = []
function! s:self.info(line, col, message) abort
let self.id = matchaddpos(self.group, [[a:line - 1, a:col - 1, len(a:message)]], 10, -1, {'conceal' : a:message})
let chars = SpaceVim#api#import('data#string').string2chars(a:message)
for index in range(len(chars))
call add(self.id, matchaddpos('Conceal', [[a:line, a:col - 1 + index, 1]], 10, -1, {'conceal' : chars[index]}))
endfor
endfunction
@ -13,7 +16,10 @@ endfunction
call s:self.set_group('SpaceVim_signatures')
function! s:self.clear() abort
call matchdelete(self.id)
for id in self.id
call matchdelete(id)
endfor
let self.id = []
endfunction

View File

@ -3,6 +3,8 @@
" @parentsection layers
" SpaceVim uses neomake as default syntax checker.
let s:SIG = SpaceVim#api#import('vim#signatures')
function! SpaceVim#layers#checkers#plugins() abort
let plugins = []
@ -41,7 +43,35 @@ 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()
augroup END
let g:neomake_echo_current_error = 0
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
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 &conceallevel = s:clv
call s:SIG.clear()
endfunction
function! s:verify_syntax_setup() abort