Support loading eslint from node_modules, re issue #118.

This commit is contained in:
w0rp
2016-10-23 13:04:41 +01:00
parent f94865c4ce
commit 36461b69d7
4 changed files with 71 additions and 4 deletions

View File

@@ -44,6 +44,21 @@ function! ale#util#FindNearestFile(buffer, filename) abort
return ''
endfunction
" Given a buffer, a string to search for, an a global fallback for when
" the search fails, look for a file in parent paths, and if that fails,
" use the global fallback path instead.
function! ale#util#ResolveLocalPath(buffer, search_string, global_fallback) abort
" Search for a locally installed file first.
let l:path = ale#util#FindNearestFile(a:buffer, a:search_string)
" If the serach fails, try the global executable instead.
if empty(l:path)
let l:path = a:global_fallback
endif
return l:path
endfunction
function! ale#util#GetFunction(string_or_ref) abort
if type(a:string_or_ref) == type('')
return function(a:string_or_ref)