diff options
author | w0rp <devw0rp@gmail.com> | 2023-09-14 00:38:12 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2023-09-14 00:40:56 +0100 |
commit | be69af270547b0d1dd5fe947efb3f61455f709ed (patch) | |
tree | 3d72ab429ed3d6025fb88accbd2be753fb78f26a /autoload/ale.vim | |
parent | 9092af9ad6a5c93a759be571323ea1d0cafa8d6e (diff) | |
download | ale-be69af270547b0d1dd5fe947efb3f61455f709ed.zip |
#4607 No conflicts with nvim-lspconfig by default
Default `g:ale_disable_lsp` to a new mode `'auto'` by default. With this
setting applied, ALE will now check for the presence of nvim-lspconfig
and automatically turn off particular LSP linters if already configured
via nvim-lspconfig.
For users that do not use `nvim-lspconfig`, everything should work as
before.
Diffstat (limited to 'autoload/ale.vim')
-rw-r--r-- | autoload/ale.vim | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim index 23315913..5212099e 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -7,9 +7,6 @@ let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error') let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info') let g:ale_echo_msg_log_str = get(g:, 'ale_echo_msg_log_str', 'Log') 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) " LSP window/showMessage format let g:ale_lsp_show_message_format = get(g:, 'ale_lsp_show_message_format', '%severity%:%linter%: %s') @@ -100,7 +97,24 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort " Use the filetype from the buffer let l:filetype = getbufvar(a:buffer, '&filetype') let l:linters = ale#linter#Get(l:filetype) - let l:linters = ale#linter#RemoveIgnored(a:buffer, l:filetype, l:linters) + + let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') + + " Load code to ignore linters only if we need to. + if ( + \ !empty(l:ignore_config) + \ || l:disable_lsp is 1 + \ || l:disable_lsp is v:true + \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) + \) + let l:linters = ale#engine#ignore#Exclude( + \ l:filetype, + \ l:linters, + \ l:ignore_config, + \ l:disable_lsp, + \) + endif " Tell other sources that they can start checking the buffer now. let g:ale_want_results_buffer = a:buffer |