From 26460a77a7c1860e504a66c4eabe586efbdfe70d Mon Sep 17 00:00:00 2001 From: Jean Mertz Date: Sat, 2 Mar 2019 16:17:17 +0100 Subject: set correct Rust span end column The Rust compiler returns the first column that is _not_ part of the current span as `column_end`, while Ale expects `end_col` to signify the last column of the span. --- autoload/ale/handlers/rust.vim | 2 +- test/handler/test_rust_handler.vader | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/autoload/ale/handlers/rust.vim b/autoload/ale/handlers/rust.vim index c6a4b670..dda6466e 100644 --- a/autoload/ale/handlers/rust.vim +++ b/autoload/ale/handlers/rust.vim @@ -60,7 +60,7 @@ function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort \ 'lnum': l:span.line_start, \ 'end_lnum': l:span.line_end, \ 'col': l:span.column_start, - \ 'end_col': l:span.column_end, + \ '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]), \}) diff --git a/test/handler/test_rust_handler.vader b/test/handler/test_rust_handler.vader index 4764e713..56db9b36 100644 --- a/test/handler/test_rust_handler.vader +++ b/test/handler/test_rust_handler.vader @@ -8,7 +8,7 @@ Execute(The Rust handler should handle rustc output): \ 'end_lnum': 15, \ 'type': 'E', \ 'col': 5, - \ 'end_col': 8, + \ 'end_col': 7, \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', \ }, \ { @@ -16,7 +16,7 @@ Execute(The Rust handler should handle rustc output): \ 'end_lnum': 13, \ 'type': 'E', \ 'col': 7, - \ 'end_col': 10, + \ 'end_col': 9, \ 'text': 'no method named `wat` found for type `std::string::String` in the current scope', \ }, \ ], @@ -84,7 +84,7 @@ Execute(The Rust handler should handle cargo output): \ 'end_lnum': 15, \ 'type': 'E', \ 'col': 5, - \ 'end_col': 8, + \ 'end_col': 7, \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', \ }, \ { @@ -92,7 +92,7 @@ Execute(The Rust handler should handle cargo output): \ 'end_lnum': 13, \ 'type': 'E', \ 'col': 7, - \ 'end_col': 10, + \ 'end_col': 9, \ 'text': 'no method named `wat` found for type `std::string::String` in the current scope', \ }, \ ], @@ -158,7 +158,7 @@ Execute(The Rust handler should should errors from expansion spans): \ 'end_lnum': 4, \ 'type': 'E', \ 'col': 21, - \ 'end_col': 23, + \ 'end_col': 22, \ 'text': 'mismatched types: expected bool, found integral variable', \ }, \ ], @@ -208,7 +208,7 @@ Execute(The Rust handler should show detailed errors): \ 'end_lnum': 4, \ 'type': 'E', \ 'col': 21, - \ 'end_col': 23, + \ 'end_col': 22, \ 'text': 'mismatched types: expected bool, found integral variable', \ }, \ ], @@ -296,7 +296,7 @@ Execute(The Rust handler should remove secondary spans if set): \ 'lnum': 1, \ 'end_lnum': 1, \ 'type': 'E', - \ 'end_col': 21, + \ 'end_col': 20, \ 'col': 1, \ 'text': 'this function takes 1 parameter but 0 were supplied: defined here', \ }, @@ -304,7 +304,7 @@ Execute(The Rust handler should remove secondary spans if set): \ 'lnum': 1, \ 'end_lnum': 1, \ 'type': 'E', - \ 'end_col': 46, + \ 'end_col': 45, \ 'col': 40, \ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter', \ }, @@ -371,7 +371,7 @@ Execute(The Rust handler should remove secondary spans if set): \ 'lnum': 1, \ 'end_lnum': 1, \ 'type': 'E', - \ 'end_col': 46, + \ 'end_col': 45, \ 'col': 40, \ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter', \ }, -- cgit v1.2.3