mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-21 17:18:38 +08:00
Close #3285 - lint_file is now dynamic
`lint_file` can now be computed dynamically with a callback function, which can return a deferred result, as per `ale#command#Run`. This allows linters to dynamically switch between checking files on disk, or checking code on the fly. Some tests have been fixed on Windows.
This commit is contained in:
@@ -211,21 +211,17 @@ function! ale#linter#PreProcess(filetype, linter) abort
|
||||
" file on disk.
|
||||
let l:obj.lint_file = get(a:linter, 'lint_file', 0)
|
||||
|
||||
if !s:IsBoolean(l:obj.lint_file)
|
||||
throw '`lint_file` must be `0` or `1`'
|
||||
if !s:IsBoolean(l:obj.lint_file) && type(l:obj.lint_file) isnot v:t_func
|
||||
throw '`lint_file` must be `0`, `1`, or a Function'
|
||||
endif
|
||||
|
||||
" An option indicating that the buffer should be read.
|
||||
let l:obj.read_buffer = get(a:linter, 'read_buffer', !l:obj.lint_file)
|
||||
let l:obj.read_buffer = get(a:linter, 'read_buffer', 1)
|
||||
|
||||
if !s:IsBoolean(l:obj.read_buffer)
|
||||
throw '`read_buffer` must be `0` or `1`'
|
||||
endif
|
||||
|
||||
if l:obj.lint_file && l:obj.read_buffer
|
||||
throw 'Only one of `lint_file` or `read_buffer` can be `1`'
|
||||
endif
|
||||
|
||||
let l:obj.aliases = get(a:linter, 'aliases', [])
|
||||
|
||||
if type(l:obj.aliases) isnot v:t_list
|
||||
|
||||
Reference in New Issue
Block a user