summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/linter.vim18
1 files changed, 10 insertions, 8 deletions
diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim
index 7e32b7bc..8aec2598 100644
--- a/autoload/ale/linter.vim
+++ b/autoload/ale/linter.vim
@@ -3,6 +3,7 @@ call ale#Set('wrap_command_as_one_argument', 0)
" Description: Linter registration and lazy-loading
" Retrieves linters as requested by the engine, loading them if needed.
+let s:runtime_loaded_map = {}
let s:linters = {}
" Default filetype aliases.
@@ -38,6 +39,7 @@ let s:default_ale_linters = {
" Testing/debugging helper to unload all linters.
function! ale#linter#Reset() abort
+ let s:runtime_loaded_map = {}
let s:linters = {}
endfunction
@@ -250,20 +252,20 @@ function! ale#linter#Define(filetype, linter) abort
call add(s:linters[a:filetype], l:new_linter)
endfunction
+" Prevent any linters from being loaded for a given filetype.
+function! ale#linter#PreventLoading(filetype) abort
+ let s:runtime_loaded_map[a:filetype] = 1
+endfunction
+
function! ale#linter#GetAll(filetypes) abort
let l:combined_linters = []
for l:filetype in a:filetypes
- " Load linter defintions from files if we haven't loaded them yet.
- if !has_key(s:linters, l:filetype)
+ " Load linters from runtimepath if we haven't done that yet.
+ if !has_key(s:runtime_loaded_map, l:filetype)
execute 'silent! runtime! ale_linters/' . l:filetype . '/*.vim'
- " Always set an empty List for the loaded linters if we don't find
- " any. This will prevent us from executing the runtime command
- " many times, redundantly.
- if !has_key(s:linters, l:filetype)
- let s:linters[l:filetype] = []
- endif
+ let s:runtime_loaded_map[l:filetype] = 1
endif
call extend(l:combined_linters, get(s:linters, l:filetype, []))