Fix signs to work with other languages, and create fewer dummy signs
This commit is contained in:
parent
f9d0673384
commit
f0da729a9d
@ -6,6 +6,7 @@ if exists('g:loaded_ale_sign')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let g:loaded_ale_sign = 1
|
let g:loaded_ale_sign = 1
|
||||||
|
let b:dummy_sign_set_map = {}
|
||||||
|
|
||||||
if !hlexists('ALEErrorSign')
|
if !hlexists('ALEErrorSign')
|
||||||
highlight link ALEErrorSign error
|
highlight link ALEErrorSign error
|
||||||
@ -41,7 +42,8 @@ sign define ALEDummySign
|
|||||||
function! ale#sign#FindCurrentSigns(buffer)
|
function! ale#sign#FindCurrentSigns(buffer)
|
||||||
" Matches output like :
|
" Matches output like :
|
||||||
" line=4 id=1 name=ALEErrorSign
|
" line=4 id=1 name=ALEErrorSign
|
||||||
let pattern = 'id=\(\d\+\) \+name=ALE\(Warning\|Error\)Sign'
|
" строка=1 id=1000001 имя=ALEErrorSign
|
||||||
|
let pattern = 'id=\(\d\+\).*=ALE\(Warning\|Error\)Sign'
|
||||||
|
|
||||||
redir => output
|
redir => output
|
||||||
silent exec 'sign place buffer=' . a:buffer
|
silent exec 'sign place buffer=' . a:buffer
|
||||||
@ -94,10 +96,14 @@ function! ale#sign#SetSigns(buffer, loclist)
|
|||||||
let signlist = ale#sign#CombineSigns(a:loclist)
|
let signlist = ale#sign#CombineSigns(a:loclist)
|
||||||
|
|
||||||
if len(signlist) > 0 || g:ale_sign_column_always
|
if len(signlist) > 0 || g:ale_sign_column_always
|
||||||
|
if !get(g:ale_buffer_sign_dummy_map, a:buffer, 0)
|
||||||
" Insert a dummy sign if one is missing.
|
" Insert a dummy sign if one is missing.
|
||||||
execute 'sign place ' . g:ale_sign_offset
|
execute 'sign place ' . g:ale_sign_offset
|
||||||
\ . ' line=1 name=ALEDummySign buffer='
|
\ . ' line=1 name=ALEDummySign buffer='
|
||||||
\ . a:buffer
|
\ . a:buffer
|
||||||
|
|
||||||
|
let g:ale_buffer_sign_dummy_map[a:buffer] = 1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Find the current signs with the markers we use.
|
" Find the current signs with the markers we use.
|
||||||
@ -122,6 +128,10 @@ function! ale#sign#SetSigns(buffer, loclist)
|
|||||||
endfor
|
endfor
|
||||||
|
|
||||||
if !g:ale_sign_column_always && len(signlist) > 0
|
if !g:ale_sign_column_always && len(signlist) > 0
|
||||||
|
if get(g:ale_buffer_sign_dummy_map, a:buffer, 0)
|
||||||
execute 'sign unplace ' . g:ale_sign_offset . ' buffer=' . a:buffer
|
execute 'sign unplace ' . g:ale_sign_offset . ' buffer=' . a:buffer
|
||||||
|
|
||||||
|
let g:ale_buffer_sign_dummy_map[a:buffer] = 0
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -29,6 +29,7 @@ let s:job_output_map = {}
|
|||||||
" Globals which each part of the plugin should use.
|
" Globals which each part of the plugin should use.
|
||||||
let g:ale_buffer_loclist_map = {}
|
let g:ale_buffer_loclist_map = {}
|
||||||
let g:ale_buffer_should_reset_map = {}
|
let g:ale_buffer_should_reset_map = {}
|
||||||
|
let g:ale_buffer_sign_dummy_map = {}
|
||||||
|
|
||||||
function! s:GetFunction(string_or_ref)
|
function! s:GetFunction(string_or_ref)
|
||||||
if type(a:string_or_ref) == type('')
|
if type(a:string_or_ref) == type('')
|
||||||
@ -256,6 +257,10 @@ function s:BufferCleanup(buffer)
|
|||||||
if has_key(g:ale_buffer_loclist_map, a:buffer)
|
if has_key(g:ale_buffer_loclist_map, a:buffer)
|
||||||
call remove(g:ale_buffer_loclist_map, a:buffer)
|
call remove(g:ale_buffer_loclist_map, a:buffer)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if has_key(g:ale_buffer_sign_dummy_map, a:buffer)
|
||||||
|
call remove(g:ale_buffer_sign_dummy_map, a:buffer)
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ALEAddLinter(filetype, linter)
|
function! ALEAddLinter(filetype, linter)
|
||||||
|
Loading…
Reference in New Issue
Block a user