mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
#817 Add commands for toggling ALE for only the current buffer
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Before:
|
||||
Save g:ale_enabled
|
||||
|
||||
function! GenerateResults(buffer, output)
|
||||
return [
|
||||
\ {
|
||||
@@ -43,7 +45,10 @@ Before:
|
||||
highlight link SomeOtherGroup SpellBad
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:items
|
||||
unlet! b:ale_enabled
|
||||
|
||||
delfunction GenerateResults
|
||||
call ale#linter#Reset()
|
||||
@@ -206,7 +211,7 @@ Execute(Highlighting should support errors spanning many lines):
|
||||
\ },
|
||||
\ ],
|
||||
\ GetMatchesWithoutIDs()
|
||||
\
|
||||
|
||||
Execute(Highlights should always be cleared when the buffer highlight list is empty):
|
||||
" Add our highlights and something else.
|
||||
call matchaddpos('ALEError', [[1, 1, 1]])
|
||||
@@ -232,3 +237,24 @@ Execute(Highlights should always be cleared when the buffer highlight list is em
|
||||
\ {'group': 'SomeOtherGroup', 'priority': 10, 'pos1': [1, 1, 1]},
|
||||
\ ],
|
||||
\ GetMatchesWithoutIDs()
|
||||
|
||||
Execute(Highlights should be cleared when ALE is disabled):
|
||||
let g:ale_enabled = 1
|
||||
call ale#highlight#SetHighlights(bufnr(''), [
|
||||
\ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1, 'end_lnum': 10, 'end_col': 3},
|
||||
\])
|
||||
|
||||
let g:ale_enabled = 0
|
||||
call ale#highlight#UpdateHighlights()
|
||||
|
||||
AssertEqual [], GetMatchesWithoutIDs()
|
||||
|
||||
let g:ale_enabled = 1
|
||||
call ale#highlight#SetHighlights(bufnr(''), [
|
||||
\ {'bufnr': bufnr(''), 'type': 'E', 'lnum': 1, 'col': 1, 'end_lnum': 10, 'end_col': 3},
|
||||
\])
|
||||
|
||||
let b:ale_enabled = 0
|
||||
call ale#highlight#UpdateHighlights()
|
||||
|
||||
AssertEqual [], GetMatchesWithoutIDs()
|
||||
|
||||
Reference in New Issue
Block a user