#817 Add commands for toggling ALE for only the current buffer

This commit is contained in:
w0rp
2017-10-28 19:36:16 +01:00
parent ea3a8e3c62
commit 5fc2b98b73
5 changed files with 188 additions and 27 deletions

View File

@@ -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()