summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-10-17 21:14:34 +0100
committerw0rp <devw0rp@gmail.com>2016-10-17 21:14:34 +0100
commit654a1724730e181c80cd262a781055c5a9f0ca05 (patch)
tree851119a3a64c9ae82cd95b3725f914c7271ec702 /autoload
parent7c2a16e149a0dbcdfcac6ee441474caaad1ef3b6 (diff)
downloadale-654a1724730e181c80cd262a781055c5a9f0ca05.zip
Make the nearest file search result absolute paths, and add tests to cover it.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/util.vim10
1 files changed, 9 insertions, 1 deletions
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim
index c218f090..82bed85a 100644
--- a/autoload/ale/util.vim
+++ b/autoload/ale/util.vim
@@ -33,7 +33,15 @@ endfunction
" Given a buffer and a filename, find the nearest file by searching upwards
" through the paths relative to the given buffer.
function! ale#util#FindNearestFile(buffer, filename) abort
- return findfile(a:filename, fnamemodify(bufname(a:buffer), ':p') . ';')
+ let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p')
+
+ let l:relative_path = findfile(a:filename, l:buffer_filename . ';')
+
+ if !empty(l:relative_path)
+ return fnamemodify(l:relative_path, ':p')
+ endif
+
+ return ''
endfunction
function! ale#util#GetFunction(string_or_ref) abort