mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
#653 - Filter items based on the buffer number for signs
This commit is contained in:
@@ -124,7 +124,6 @@ Execute(The current signs should be set for running a job):
|
||||
\ ],
|
||||
\ ParseSigns()
|
||||
|
||||
|
||||
Execute(Loclist items with sign_id values should be kept):
|
||||
exec 'sign place 1000347 line=3 name=ALEErrorSign buffer=' . bufnr('%')
|
||||
exec 'sign place 1000348 line=15 name=ALEErrorSign buffer=' . bufnr('%')
|
||||
@@ -169,5 +168,32 @@ Execute(Loclist items with sign_id values should be kept):
|
||||
\ ],
|
||||
\ sort(ParseSigns())
|
||||
|
||||
Execute(Items for other buffers should be ignored):
|
||||
let g:loclist = [
|
||||
\ {'bufnr': bufnr('') - 1, 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'},
|
||||
\ {'bufnr': bufnr('') - 1, 'lnum': 2, 'col': 1, 'type': 'E', 'text': 'a', 'sign_id': 1000347},
|
||||
\ {'bufnr': bufnr(''), 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'},
|
||||
\ {'bufnr': bufnr(''), 'lnum': 2, 'col': 1, 'type': 'W', 'text': 'b'},
|
||||
\ {'bufnr': bufnr(''), 'lnum': 3, 'col': 1, 'type': 'E', 'text': 'c'},
|
||||
\ {'bufnr': bufnr(''), 'lnum': 4, 'col': 1, 'type': 'W', 'text': 'd'},
|
||||
\ {'bufnr': bufnr(''), 'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'},
|
||||
\ {'bufnr': bufnr(''), 'lnum': 16, 'col': 2, 'type': 'E', 'text': 'f'},
|
||||
\ {'bufnr': bufnr('') + 1, 'lnum': 1, 'col': 1, 'type': 'E', 'text': 'a'},
|
||||
\]
|
||||
|
||||
call ale#sign#SetSigns(bufnr(''), g:loclist)
|
||||
call ale#sign#RemoveDummySignIfNeeded(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ ['1', '1000001', 'ALEErrorSign'],
|
||||
\ ['15', '1000005', 'ALEWarningSign'],
|
||||
\ ['16', '1000006', 'ALEErrorSign'],
|
||||
\ ['2', '1000002', 'ALEWarningSign'],
|
||||
\ ['3', '1000003', 'ALEErrorSign'],
|
||||
\ ['4', '1000004', 'ALEWarningSign'],
|
||||
\ ],
|
||||
\ sort(ParseSigns())
|
||||
|
||||
Execute(No excpetions should be thrown when setting signs for invalid buffers):
|
||||
call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}])
|
||||
|
||||
Reference in New Issue
Block a user