summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorrhysd <lin90162@yahoo.co.jp>2019-03-30 13:53:18 +0900
committerrhysd <lin90162@yahoo.co.jp>2019-03-30 15:29:17 +0900
commit6a29641872f78c3f565418f3f754070a4b1ebe1e (patch)
tree15ac8103e48c5e4dd53f6acbfbe5c11339f018c3 /autoload
parent89273b65b8de9d3d428e7b1f5c0c347938f5a863 (diff)
downloadale-6a29641872f78c3f565418f3f754070a4b1ebe1e.zip
Add g:ale_disable_lsp and b:ale_disable_lsp to disable linters powered by LSP
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale.vim4
-rw-r--r--autoload/ale/engine/ignore.vim6
2 files changed, 8 insertions, 2 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim
index 5aa5fbfc..bcb89095 100644
--- a/autoload/ale.vim
+++ b/autoload/ale.vim
@@ -8,6 +8,7 @@ let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info')
let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning')
" Ignoring linters, for disabling some, or ignoring LSP diagnostics.
let g:ale_linters_ignore = get(g:, 'ale_linters_ignore', {})
+let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 0)
let s:lint_timer = -1
let s:getcmdwintype_exists = exists('*getcmdwintype')
@@ -90,8 +91,9 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort
" Apply ignore lists for linters only if needed.
let l:ignore_config = ale#Var(a:buffer, 'linters_ignore')
+ let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp')
let l:linters = !empty(l:ignore_config)
- \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config)
+ \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config, l:disable_lsp)
\ : l:linters
" Tell other sources that they can start checking the buffer now.
diff --git a/autoload/ale/engine/ignore.vim b/autoload/ale/engine/ignore.vim
index 2db2c6c1..80574656 100644
--- a/autoload/ale/engine/ignore.vim
+++ b/autoload/ale/engine/ignore.vim
@@ -22,7 +22,7 @@ function! ale#engine#ignore#GetList(filetype, config) abort
endfunction
" Given a List of linter descriptions, exclude the linters to be ignored.
-function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort
+function! ale#engine#ignore#Exclude(filetype, all_linters, config, disable_lsp) abort
let l:names_to_remove = ale#engine#ignore#GetList(a:filetype, a:config)
let l:filtered_linters = []
@@ -37,6 +37,10 @@ function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort
endif
endfor
+ if a:disable_lsp && has_key(l:linter, 'lsp') && l:linter.lsp isnot# ''
+ let l:should_include = 0
+ endif
+
if l:should_include
call add(l:filtered_linters, l:linter)
endif