Allow customisation of the signs
Too many plugins use the default priority of 10 so they race/chase. Allow uses to configure the priorities and make sure that the defaults are documented.
This commit is contained in:
parent
e634982d78
commit
c1b544fb3c
12 changed files with 370 additions and 113 deletions
|
|
@ -46,7 +46,8 @@ endfunction
|
|||
|
||||
function! vimspector#test#signs#AssertSignGroupSingletonAtLine( group,
|
||||
\ line,
|
||||
\ sign_name )
|
||||
\ sign_name,
|
||||
\ priority )
|
||||
\ abort
|
||||
|
||||
let signs = sign_getplaced( '%', {
|
||||
|
|
@ -62,10 +63,46 @@ function! vimspector#test#signs#AssertSignGroupSingletonAtLine( group,
|
|||
\ 'Num signs in ' . a:group . ' at ' . a:line ) ||
|
||||
\ assert_equal( a:sign_name,
|
||||
\ signs[ 0 ].signs[ 0 ].name,
|
||||
\ 'Sign in group ' . a:group . ' at ' . a:line )
|
||||
\ 'Sign in group ' . a:group . ' at ' . a:line ) ||
|
||||
\ assert_equal( a:priority,
|
||||
\ signs[ 0 ].signs[ 0 ].priority,
|
||||
\ 'Sign priority in group ' . a:group . ' at ' . a:line )
|
||||
endfunction
|
||||
|
||||
|
||||
function! vimspector#test#signs#AssertSignAtLine( group, line, sign_name, priority ) abort
|
||||
|
||||
let signs = sign_getplaced( '%', {
|
||||
\ 'group': a:group,
|
||||
\ 'lnum': a:line,
|
||||
\ } )
|
||||
|
||||
let errors_before = v:errors
|
||||
let result = 1
|
||||
let errors = [ 'No signs were found' ]
|
||||
|
||||
for sign in signs[ 0 ].signs
|
||||
let v:errors = []
|
||||
|
||||
let result =
|
||||
\ assert_equal( a:sign_name,
|
||||
\ sign.name,
|
||||
\ 'Sign in group ' . a:group . ' at ' . a:line ) ||
|
||||
\ assert_equal( a:priority,
|
||||
\ sign.priority,
|
||||
\ 'Sign priority in group ' . a:group . ' at ' . a:line )
|
||||
if result
|
||||
let errors = v:errors
|
||||
else
|
||||
let errors = []
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
let v:errors = errors_before + errors
|
||||
return result
|
||||
endfunction
|
||||
|
||||
function! vimspector#test#signs#AssertSignGroupEmptyAtLine( group, line ) abort
|
||||
let signs = sign_getplaced( '%', {
|
||||
\ 'group': a:group,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue