Add a function for finding nearest files, and use it to fix JSHint so it will find configuration files automatically.

This commit is contained in:
w0rp
2016-10-04 18:24:46 +01:00
parent bd2f39f21a
commit c6dc324add
2 changed files with 28 additions and 6 deletions

View File

@@ -24,3 +24,9 @@ let g:ale#util#stdin_wrapper = s:FindWrapperScript()
function! ale#util#GetLineCount(buffer)
return len(getbufline(a:buffer, 1, '$'))
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)
return findfile(a:filename, fnamemodify(bufname(a:buffer), ':p') . ';')
endfunction