mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 21:12:31 +08:00
Print the most severe problem with virtualtext
Fix the ordering of virtualtext so we print the most severe problem on a line. If two problems are the most severe, we will print the left-most problem.
This commit is contained in:
@@ -37,6 +37,27 @@ Before:
|
||||
\ 'col': 5,
|
||||
\ 'text': 'Line 2 warning 2',
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': bufnr(''),
|
||||
\ 'type': 'W',
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'Line 3 warning 1',
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': bufnr(''),
|
||||
\ 'type': 'E',
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 5,
|
||||
\ 'text': 'Line 3 error 1',
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': bufnr(''),
|
||||
\ 'type': 'E',
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 6,
|
||||
\ 'text': 'Line 3 error 2',
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\}
|
||||
@@ -79,6 +100,7 @@ Execute(Comment text should be detected correctly for HTML files):
|
||||
Given python(An example Python file):
|
||||
# line 1
|
||||
# line 2
|
||||
# line 3
|
||||
|
||||
Execute(We should not show virtualtext when disabled):
|
||||
if has('patch-9.0.0297') || has('nvim-0.8.0')
|
||||
@@ -157,11 +179,11 @@ Execute(We should be able to change the virtualtext prefix per-buffer):
|
||||
AssertEqual 'B> Line 1 error', ale#virtualtext#GetLastMessageForTests()
|
||||
endif
|
||||
|
||||
Execute(We should set errors across all lines):
|
||||
Execute(We should be able to set messages across all lines):
|
||||
if has('patch-9.0.0297') || has('nvim-0.8.0')
|
||||
call ale#virtualtext#SetTexts(bufnr(''), g:ale_buffer_info[bufnr('')].loclist)
|
||||
|
||||
AssertEqual '# W: Line 2 warning 2', ale#virtualtext#GetLastMessageForTests()
|
||||
AssertEqual '# E: Line 3 error 2', ale#virtualtext#GetLastMessageForTests()
|
||||
|
||||
if has('patch-9.0.0297')
|
||||
AssertEqual ['ALEVirtualTextError'], map(prop_list(1), {_, v -> v.type})
|
||||
@@ -176,12 +198,12 @@ Execute(We should be able to limit virtual messages to the first one only):
|
||||
if has('patch-9.0.0297') || has('nvim-0.8.0')
|
||||
call ale#virtualtext#SetTexts(bufnr(''), g:ale_buffer_info[bufnr('')].loclist)
|
||||
|
||||
AssertEqual '# W: Line 2 warning 1', ale#virtualtext#GetLastMessageForTests()
|
||||
AssertEqual '# E: Line 3 error 1', ale#virtualtext#GetLastMessageForTests()
|
||||
|
||||
if has('patch-9.0.0297')
|
||||
AssertEqual ['ALEVirtualTextError'], map(prop_list(1), {_, v -> v.type})
|
||||
AssertEqual ['ALEVirtualTextWarning'],
|
||||
\ map(prop_list(2), {_, v -> v.type})
|
||||
AssertEqual ['ALEVirtualTextWarning'], map(prop_list(2), {_, v -> v.type})
|
||||
AssertEqual ['ALEVirtualTextError'], map(prop_list(3), {_, v -> v.type})
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user