diff options
author | w0rp <devw0rp@gmail.com> | 2017-08-20 00:05:15 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-08-20 00:05:15 +0100 |
commit | 7112776d1b04d2cb01a1b01c0edfa5b86ed88e99 (patch) | |
tree | 423cb978a7e7e680013dd819b2bf20721eede77d /autoload | |
parent | fb0adc602e13fb9d7ee41bb1d3303fdc6bfb45f5 (diff) | |
download | ale-7112776d1b04d2cb01a1b01c0edfa5b86ed88e99.zip |
#653 Update tslint to set the filename key for problems in other files
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/engine.vim | 11 | ||||
-rw-r--r-- | autoload/ale/path.vim | 13 |
2 files changed, 18 insertions, 6 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index 6a168958..40930038 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -362,6 +362,7 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort " The linter_name will be set on the errors so it can be used in " output, filtering, etc.. let l:item = { + \ 'bufnr': a:buffer, \ 'text': l:old_item.text, \ 'lnum': str2nr(l:old_item.lnum), \ 'col': str2nr(get(l:old_item, 'col', 0)), @@ -372,7 +373,11 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort \} if has_key(l:old_item, 'filename') + \&& l:old_item.filename[:len(s:temp_dir) - 1] isnot# s:temp_dir " Use the filename given. + " Temporary files are assumed to be for this buffer, + " and the filename is not included then, because it looks bad + " in the loclist window. let l:filename = l:old_item.filename let l:item.filename = l:filename @@ -384,10 +389,6 @@ 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) @@ -395,8 +396,6 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort endif elseif has_key(l:old_item, 'bufnr') let l:item.bufnr = l:old_item.bufnr - else - let l:item.bufnr = a:buffer endif if has_key(l:old_item, 'detail') diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim index 49069478..bc026cc2 100644 --- a/autoload/ale/path.vim +++ b/autoload/ale/path.vim @@ -86,6 +86,19 @@ function! ale#path#IsTempName(filename) abort return 0 endfunction +" Given a base directory, which must not have a trailing slash, and a +" filename, which may have an absolute path a path relative to the base +" directory, return the absolute path to the file. +function! ale#path#GetAbsPath(base_directory, filename) abort + if ale#path#IsAbsolute(a:filename) + return a:filename + endif + + let l:sep = has('win32') ? '\' : '/' + + return ale#path#Simplify(a:base_directory . l:sep . a:filename) +endfunction + " Given a buffer number and a relative or absolute path, return 1 if the " two paths represent the same file on disk. function! ale#path#IsBufferPath(buffer, complex_filename) abort |