summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authordaa84 <andrey.dubravin@gmail.com>2017-07-07 19:03:17 +0300
committerw0rp <w0rp@users.noreply.github.com>2017-07-07 17:03:17 +0100
commit46225f3bb13a242bf3b218d395f3911f013d5f14 (patch)
tree537f368d95307f1ff60393f1579f08dc5d8b9ac8 /autoload
parentd9a7364dae5af3f193fa9e4cee221730a8ffd46e (diff)
downloadale-46225f3bb13a242bf3b218d395f3911f013d5f14.zip
Fix windows path check on rust linter (#736)
* Fix rust linter on windows * Add windows path test * Use ale#path#IsBufferPath to compare paths * Fix errors
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/handlers/rust.vim11
1 files changed, 5 insertions, 6 deletions
diff --git a/autoload/ale/handlers/rust.vim b/autoload/ale/handlers/rust.vim
index 47b3c7f2..3f9083a5 100644
--- a/autoload/ale/handlers/rust.vim
+++ b/autoload/ale/handlers/rust.vim
@@ -8,13 +8,13 @@ if !exists('g:ale_rust_ignore_error_codes')
endif
" returns: a list [lnum, col] with the location of the error or []
-function! s:FindErrorInExpansion(span, file_name) abort
- if a:span.file_name ==# a:file_name
+function! s:FindErrorInExpansion(span, buffer) abort
+ if ale#path#IsBufferPath(a:buffer, a:span.file_name)
return [a:span.line_start, a:span.line_end, a:span.byte_start, a:span.byte_end]
endif
if !empty(a:span.expansion)
- return s:FindErrorInExpansion(a:span.expansion.span, a:file_name)
+ return s:FindErrorInExpansion(a:span.expansion.span, a:buffer)
endif
return []
@@ -22,7 +22,6 @@ endfunction
" A handler function which accepts a file name, to make unit testing easier.
function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines) abort
- let l:filename = fnamemodify(a:full_filename, ':t')
let l:output = []
for l:errorline in a:lines
@@ -48,7 +47,7 @@ function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines
for l:span in l:error.spans
if (
\ l:span.is_primary
- \ && (a:full_filename =~ (l:span.file_name . '$') || l:span.file_name ==# '<anon>')
+ \ && (ale#path#IsBufferPath(a:buffer, l:span.file_name) || l:span.file_name ==# '<anon>')
\)
call add(l:output, {
\ 'lnum': l:span.line_start,
@@ -61,7 +60,7 @@ function! ale#handlers#rust#HandleRustErrorsForFile(buffer, full_filename, lines
else
" when the error is caused in the expansion of a macro, we have
" to bury deeper
- let l:root_cause = s:FindErrorInExpansion(l:span, l:filename)
+ let l:root_cause = s:FindErrorInExpansion(l:span, a:buffer)
if !empty(l:root_cause)
call add(l:output, {