diff options
author | cos <cos> | 2022-02-18 17:23:09 +0100 |
---|---|---|
committer | cos <cos> | 2022-02-19 16:53:08 +0100 |
commit | 63f61ce67ece7ffc8a6dd6c18c60d3d019162b29 (patch) | |
tree | 34bf75ce7bd0860785c683ab98a1d35c93529c77 | |
parent | 573ffd3b1e74dd0a6bd568ea3d163e7b38390655 (diff) | |
download | ale-63f61ce67ece7ffc8a6dd6c18c60d3d019162b29.zip |
fixup, wip: Rename error variable as in docs
This corresponds better with the terminology used at:
https://doc.rust-lang.org/rustc/json.html
-rw-r--r-- | autoload/ale/handlers/rust.vim | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/autoload/ale/handlers/rust.vim b/autoload/ale/handlers/rust.vim index 8ad7b031..12a826e0 100644 --- a/autoload/ale/handlers/rust.vim +++ b/autoload/ale/handlers/rust.vim @@ -17,27 +17,27 @@ function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort " Format of JSON " rustc: https://doc.rust-lang.org/rustc/json.html " cargo: https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages - for l:errorline in a:lines + for l:diagnosticsline in a:lines " ignore everything that is not JSON - if l:errorline !~# '^{' + if l:diagnosticsline !~# '^{' continue endif - let l:error = json_decode(l:errorline) + let l:diagnostics = json_decode(l:diagnosticsline) - if has_key(l:error, 'message') && type(l:error.message) is v:t_dict - let l:error = l:error.message + if has_key(l:diagnostics, 'message') && type(l:diagnostics.message) is v:t_dict + let l:diagnostics = l:diagnostics.message endif - if !has_key(l:error, 'code') + if !has_key(l:diagnostics, 'code') continue endif - if !empty(l:error.code) && index(g:ale_rust_ignore_error_codes, l:error.code.code) > -1 + if !empty(l:diagnostics.code) && index(g:ale_rust_ignore_error_codes, l:diagnostics.code.code) > -1 continue endif - for l:root_span in l:error.spans + for l:root_span in l:diagnostics.spans let l:span = l:root_span if ale#Var(a:buffer, 'rust_ignore_secondary_spans') && !get(l:span, 'is_primary', 1) @@ -52,12 +52,12 @@ function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort \ 'end_lnum': l:span.line_end, \ 'col': l:span.column_start, \ 'end_col': l:span.column_end-1, - \ 'text': empty(l:span.label) ? l:error.message : printf('%s: %s', l:error.message, l:span.label), - \ 'type': toupper(l:error.level[0]), + \ 'text': empty(l:span.label) ? l:diagnostics.message : printf('%s: %s', l:diagnostics.message, l:span.label), + \ 'type': toupper(l:diagnostics.level[0]), \} - if has_key(l:error, 'rendered') && !empty(l:error.rendered) - let l:output_line.detail = l:error.rendered + if has_key(l:diagnostics, 'rendered') && !empty(l:diagnostics.rendered) + let l:output_line.detail = l:diagnostics.rendered endif call add(l:output, l:output_line) |