diff options
author | Dan Aloni <alonid@gmail.com> | 2018-10-26 11:38:20 +0300 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2018-10-26 09:38:20 +0100 |
commit | aa0203320b128d6a4b83c4c1dc3c72bd36eda7d1 (patch) | |
tree | e9bb7802c6f7d71ce0735a8ef17871a27c42ca72 /autoload | |
parent | 77aacf0c91e15449e9b0c332047b666dd21ee9d4 (diff) | |
download | ale-aa0203320b128d6a4b83c4c1dc3c72bd36eda7d1.zip |
Rust checker: allow secondary spans to be ignored (#1696)
* Rust checker: allow secondary spans to be ignored
* test/handler/test_rust_handler.vader: Add tests for g:ale_rust_ignore_secondary_spans
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/handlers/rust.vim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/autoload/ale/handlers/rust.vim b/autoload/ale/handlers/rust.vim index f12c53be..c6a4b670 100644 --- a/autoload/ale/handlers/rust.vim +++ b/autoload/ale/handlers/rust.vim @@ -7,6 +7,10 @@ if !exists('g:ale_rust_ignore_error_codes') let g:ale_rust_ignore_error_codes = [] endif +if !exists('g:ale_rust_ignore_secondary_spans') + let g:ale_rust_ignore_secondary_spans = 0 +endif + function! s:FindSpan(buffer, span) abort if ale#path#IsBufferPath(a:buffer, a:span.file_name) || a:span.file_name is# '<anon>' return a:span @@ -47,6 +51,10 @@ function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort for l:root_span in l:error.spans let l:span = s:FindSpan(a:buffer, l:root_span) + if ale#Var(a:buffer, 'rust_ignore_secondary_spans') && !get(l:span, 'is_primary', 1) + continue + endif + if !empty(l:span) call add(l:output, { \ 'lnum': l:span.line_start, |