summaryrefslogtreecommitdiff
path: root/ale_linters/javascript/flow.vim
diff options
context:
space:
mode:
authorRafał Cieślak <ravicious@gmail.com>2017-04-16 12:45:42 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-04-16 11:45:42 +0100
commit2643f9f11950ca02824f57b235c7c182c30bca78 (patch)
tree75b042848b42e99d9a019bbaf54c14e8686ab141 /ale_linters/javascript/flow.vim
parente97dada261c4a69f43c5a6c34d349ad6246fe34c (diff)
downloadale-2643f9f11950ca02824f57b235c7c182c30bca78.zip
Flow: Fix case where 1st msg points to different file (#477)
* Flow: Fix case where 1st msg points to different file * Remove `bufnr` from Flow handler output * Fix the failing test & add a new one
Diffstat (limited to 'ale_linters/javascript/flow.vim')
-rw-r--r--ale_linters/javascript/flow.vim7
1 files changed, 4 insertions, 3 deletions
diff --git a/ale_linters/javascript/flow.vim b/ale_linters/javascript/flow.vim
index 07900310..90d6f420 100644
--- a/ale_linters/javascript/flow.vim
+++ b/ale_linters/javascript/flow.vim
@@ -48,8 +48,10 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
let l:col = 0
for l:message in l:error.message
- " Comments have no line of column information
- if has_key(l:message, 'loc') && l:line ==# 0
+ " Comments have no line of column information, so we skip them.
+ " In certain cases, `l:message.loc.source` points to a different path
+ " than the buffer one, thus we skip this loc information too.
+ if has_key(l:message, 'loc') && l:line ==# 0 && l:message.loc.source ==# expand('#' . a:buffer . ':p')
let l:line = l:message.loc.start.line + 0
let l:col = l:message.loc.start.column + 0
endif
@@ -66,7 +68,6 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
endif
call add(l:output, {
- \ 'bufnr': a:buffer,
\ 'lnum': l:line,
\ 'col': l:col,
\ 'text': l:text,