mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
Update sig api
This commit is contained in:
parent
8679409af1
commit
7db6faed6c
@ -1,7 +1,10 @@
|
|||||||
let s:self = {}
|
let s:self = {}
|
||||||
|
let s:self.id = []
|
||||||
function! s:self.info(line, col, message) abort
|
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
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@ -13,7 +16,10 @@ endfunction
|
|||||||
call s:self.set_group('SpaceVim_signatures')
|
call s:self.set_group('SpaceVim_signatures')
|
||||||
|
|
||||||
function! s:self.clear() abort
|
function! s:self.clear() abort
|
||||||
call matchdelete(self.id)
|
for id in self.id
|
||||||
|
call matchdelete(id)
|
||||||
|
endfor
|
||||||
|
let self.id = []
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
" @parentsection layers
|
" @parentsection layers
|
||||||
" SpaceVim uses neomake as default syntax checker.
|
" SpaceVim uses neomake as default syntax checker.
|
||||||
|
|
||||||
|
let s:SIG = SpaceVim#api#import('vim#signatures')
|
||||||
|
|
||||||
function! SpaceVim#layers#checkers#plugins() abort
|
function! SpaceVim#layers#checkers#plugins() abort
|
||||||
let plugins = []
|
let plugins = []
|
||||||
|
|
||||||
@ -41,7 +43,35 @@ function! SpaceVim#layers#checkers#config() abort
|
|||||||
if g:spacevim_enable_ale
|
if g:spacevim_enable_ale
|
||||||
autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
autocmd User ALELint let &l:statusline = SpaceVim#layers#core#statusline#get(1)
|
||||||
endif
|
endif
|
||||||
|
autocmd CursorHold * call <SID>signatures_current_error()
|
||||||
|
autocmd CursorMoved * call <SID>signatures_clear()
|
||||||
augroup END
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:verify_syntax_setup() abort
|
function! s:verify_syntax_setup() abort
|
||||||
|
Loading…
x
Reference in New Issue
Block a user