-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#734 - Use the buffer number from the events for entering buffers and…
… saving buffers for checking buffers
- Loading branch information
Showing
8 changed files
with
52 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,35 @@ | ||
" Author: w0rp <devw0rp@gmail.com> | ||
|
||
function! ale#events#SaveEvent() abort | ||
let l:should_lint = g:ale_enabled && g:ale_lint_on_save | ||
function! ale#events#SaveEvent(buffer) abort | ||
let l:should_lint = ale#Var(a:buffer, 'enabled') && g:ale_lint_on_save | ||
|
||
if g:ale_fix_on_save | ||
let l:will_fix = ale#fix#Fix('save_file') | ||
let l:should_lint = l:should_lint && !l:will_fix | ||
endif | ||
|
||
if l:should_lint | ||
call ale#Queue(0, 'lint_file') | ||
call ale#Queue(0, 'lint_file', a:buffer) | ||
endif | ||
endfunction | ||
|
||
function! s:LintOnEnter() abort | ||
if g:ale_enabled && g:ale_lint_on_enter && has_key(b:, 'ale_file_changed') | ||
function! s:LintOnEnter(buffer) abort | ||
if ale#Var(a:buffer, 'enabled') | ||
\&& g:ale_lint_on_enter | ||
\&& has_key(b:, 'ale_file_changed') | ||
call remove(b:, 'ale_file_changed') | ||
call ale#Queue(0, 'lint_file') | ||
call ale#Queue(0, 'lint_file', a:buffer) | ||
endif | ||
endfunction | ||
|
||
function! ale#events#EnterEvent() abort | ||
call s:LintOnEnter() | ||
function! ale#events#EnterEvent(buffer) abort | ||
call s:LintOnEnter(a:buffer) | ||
endfunction | ||
|
||
function! ale#events#FileChangedEvent(buffer) abort | ||
call setbufvar(a:buffer, 'ale_file_changed', 1) | ||
|
||
if bufnr('') == a:buffer | ||
call s:LintOnEnter() | ||
call s:LintOnEnter(a:buffer) | ||
endif | ||
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters