Fix #2399 - Do not check buffers used for displaying diffs

This commit is contained in:
w0rp 2019-04-08 13:42:09 +01:00
parent bbb6e70377
commit 950204b133
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
2 changed files with 14 additions and 0 deletions

View File

@ -43,6 +43,11 @@ function! ale#ShouldDoNothing(buffer) abort
return 1 return 1
endif endif
" Do nothing for diff buffers.
if getbufvar(a:buffer, '&diff')
return 1
endif
" Do nothing for blacklisted files. " Do nothing for blacklisted files.
if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0 if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0
return 1 return 1

View File

@ -35,6 +35,10 @@ After:
unlet! b:funky_command_created unlet! b:funky_command_created
unlet! b:fake_mode unlet! b:fake_mode
if &diff is 1
let &diff = 0
endif
runtime autoload/ale/util.vim runtime autoload/ale/util.vim
Given foobar(An empty file): Given foobar(An empty file):
@ -70,6 +74,11 @@ Execute(DoNothing should return 1 when an operator is pending):
AssertEqual 1, ale#ShouldDoNothing(bufnr('')) AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
Execute(DoNothing should return 1 for diff buffers):
let &diff = 1
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
Execute(The DoNothing check should work if the ALE globals aren't defined): Execute(The DoNothing check should work if the ALE globals aren't defined):
unlet! g:ale_filetype_blacklist unlet! g:ale_filetype_blacklist
unlet! g:ale_maximum_file_size unlet! g:ale_maximum_file_size