summaryrefslogtreecommitdiff
path: root/autoload/ale.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-03-14 23:51:57 +0000
committerw0rp <devw0rp@gmail.com>2017-03-14 23:51:57 +0000
commite7d32fe37677636a0be087163c1efa7d0ba10d47 (patch)
treea605ebb4cf464fc6b797942ec9a1d452d4bd6918 /autoload/ale.vim
parent790c614b7a2360446aee6e003e3e834d21b2f04b (diff)
downloadale-e7d32fe37677636a0be087163c1efa7d0ba10d47.zip
#333 Pass in a flag indicating that linters should be run against files, and clear more jobs
Diffstat (limited to 'autoload/ale.vim')
-rw-r--r--autoload/ale.vim29
1 files changed, 16 insertions, 13 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim
index c81a57a6..2d29c8f7 100644
--- a/autoload/ale.vim
+++ b/autoload/ale.vim
@@ -3,6 +3,7 @@
" Manages execution of linters when requested by autocommands
let s:lint_timer = -1
+let s:should_lint_file = 0
" A function for checking various conditions whereby ALE just shouldn't
" attempt to do anything, say if particular buffer types are open in Vim.
@@ -13,11 +14,25 @@ function! ale#ShouldDoNothing() abort
\ || ale#util#InSandbox()
endfunction
-function! ale#Queue(delay) abort
+" (delay, [run_file_linters])
+function! ale#Queue(delay, ...) abort
+ if len(a:0) > 1
+ throw 'too many arguments!'
+ endif
+
+ let l:a1 = len(a:0) > 1 ? a:1 : 0
+
+ if type(l:a1) != type(1) || (l:a1 != 0 && l:a1 != 1)
+ throw 'The lint_file argument must be a Number which is either 0 or 1!'
+ endif
+
if ale#ShouldDoNothing()
return
endif
+ " Remember the event used for linting.
+ let s:should_lint_file = l:a1
+
if s:lint_timer != -1
call timer_stop(s:lint_timer)
let s:lint_timer = -1
@@ -51,18 +66,6 @@ function! ale#Lint(...) abort
let g:ale_buffer_info[l:buffer].new_loclist = []
for l:linter in l:linters
- " Check if a given linter has a program which can be executed.
- if has_key(l:linter, 'executable_callback')
- let l:executable = ale#util#GetFunction(l:linter.executable_callback)(l:buffer)
- else
- let l:executable = l:linter.executable
- endif
-
- if !executable(l:executable)
- " The linter's program cannot be executed, so skip it.
- continue
- endif
-
call ale#engine#Invoke(l:buffer, l:linter)
endfor
endfunction