summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-19 21:18:27 +0100
committerw0rp <devw0rp@gmail.com>2017-08-19 21:18:27 +0100
commitfb0adc602e13fb9d7ee41bb1d3303fdc6bfb45f5 (patch)
tree6fdb3191c0632310c9d11c0e684b384801708954 /autoload
parent9d6883561c9ea04a8552904eda518e49670fa7cb (diff)
downloadale-fb0adc602e13fb9d7ee41bb1d3303fdc6bfb45f5.zip
#653 Treat temporary filenames as being for the current buffer
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/engine.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index 828f8468..6a168958 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -336,6 +336,9 @@ function! s:RemapItemTypes(type_map, loclist) abort
endfor
endfunction
+" Save the temporary directory so we can figure out if files are in it.
+let s:temp_dir = fnamemodify(tempname(), ':h')
+
function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
let l:bufnr_map = {}
let l:new_loclist = []
@@ -381,6 +384,10 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
elseif has_key(l:bufnr_map, l:filename)
" Get the buffer number from the map, which can be faster.
let l:item.bufnr = l:bufnr_map[l:filename]
+ elseif l:filename[:len(s:temp_dir) - 1] is# s:temp_dir
+ " Assume that any temporary files are for this buffer.
+ let l:item.bufnr = a:buffer
+ let l:bufnr_map[l:filename] = a:buffer
else
" Look up the buffer number.
let l:item.bufnr = bufnr(l:filename)