Include location list end column for rust lint (#602)

* Include location list end column for rust lint

Fixes #599.

* Include rust lint end_lnum for good measure

* Reverse engineer end_* for rust lint tests
This commit is contained in:
Jon Gjengset 2017-05-31 08:17:04 -04:00 committed by w0rp
parent ab50b3a88a
commit 5eb80f03a2
2 changed files with 14 additions and 2 deletions

View File

@ -10,7 +10,7 @@ endif
" returns: a list [lnum, col] with the location of the error or [] " returns: a list [lnum, col] with the location of the error or []
function! s:FindErrorInExpansion(span, file_name) abort function! s:FindErrorInExpansion(span, file_name) abort
if a:span.file_name ==# a:file_name if a:span.file_name ==# a:file_name
return [a:span.line_start, a:span.byte_start] return [a:span.line_start, a:span.line_end, a:span.byte_start, a:span.byte_end]
endif endif
if !empty(a:span.expansion) if !empty(a:span.expansion)
@ -52,7 +52,9 @@ function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines
\) \)
call add(l:output, { call add(l:output, {
\ 'lnum': l:span.line_start, \ 'lnum': l:span.line_start,
\ 'end_lnum': l:span.line_end,
\ 'col': l:span.byte_start, \ 'col': l:span.byte_start,
\ 'end_col': l:span.byte_end,
\ 'text': l:error.message, \ 'text': l:error.message,
\ 'type': toupper(l:error.level[0]), \ 'type': toupper(l:error.level[0]),
\}) \})
@ -64,7 +66,9 @@ function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines
if !empty(l:root_cause) if !empty(l:root_cause)
call add(l:output, { call add(l:output, {
\ 'lnum': l:root_cause[0], \ 'lnum': l:root_cause[0],
\ 'col': l:root_cause[1], \ 'end_lnum': l:root_cause[1],
\ 'col': l:root_cause[2],
\ 'end_col': l:root_cause[3],
\ 'text': l:error.message, \ 'text': l:error.message,
\ 'type': toupper(l:error.level[0]), \ 'type': toupper(l:error.level[0]),
\}) \})

View File

@ -3,14 +3,18 @@ Execute(The Rust handler should handle rustc output):
\ [ \ [
\ { \ {
\ 'lnum': 15, \ 'lnum': 15,
\ 'end_lnum': 15,
\ 'type': 'E', \ 'type': 'E',
\ 'col': 418, \ 'col': 418,
\ 'end_col': 421,
\ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`',
\ }, \ },
\ { \ {
\ 'lnum': 13, \ 'lnum': 13,
\ 'end_lnum': 13,
\ 'type': 'E', \ 'type': 'E',
\ 'col': 407, \ 'col': 407,
\ 'end_col': 410,
\ 'text': 'no method named `wat` found for type `std::string::String` in the current scope', \ 'text': 'no method named `wat` found for type `std::string::String` in the current scope',
\ }, \ },
\ ], \ ],
@ -28,14 +32,18 @@ Execute(The Rust handler should handle cargo output):
\ [ \ [
\ { \ {
\ 'lnum': 15, \ 'lnum': 15,
\ 'end_lnum': 15,
\ 'type': 'E', \ 'type': 'E',
\ 'col': 11505, \ 'col': 11505,
\ 'end_col': 11508,
\ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`',
\ }, \ },
\ { \ {
\ 'lnum': 13, \ 'lnum': 13,
\ 'end_lnum': 13,
\ 'type': 'E', \ 'type': 'E',
\ 'col': 11494, \ 'col': 11494,
\ 'end_col': 11497,
\ 'text': 'no method named `wat` found for type `std::string::String` in the current scope', \ 'text': 'no method named `wat` found for type `std::string::String` in the current scope',
\ }, \ },
\ ], \ ],