Enable gopls by default with GOPATH detection

This commit is contained in:
w0rp
2021-05-26 22:43:30 +01:00
parent 3f386ae5e9
commit f53431331e
75 changed files with 183 additions and 116 deletions

View File

@@ -77,6 +77,42 @@ function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abor
return l:path
endfunction
" Given a buffer number, a base variable name, and a list of paths to search
" for in ancestor directories, detect the executable path for a program.
function! ale#path#FindNearestExecutable(buffer, path_list) abort
for l:path in a:path_list
if ale#path#IsAbsolute(l:path)
let l:executable = filereadable(l:path) ? l:path : ''
else
let l:executable = ale#path#FindNearestFile(a:buffer, l:path)
endif
if !empty(l:executable)
return l:executable
endif
endfor
return ''
endfunction
" Given a buffer number, a base variable name, and a list of paths to search
" for in ancestor directories, detect the executable path for a program.
"
" The use_global and executable options for the relevant program will be used.
function! ale#path#FindExecutable(buffer, base_var_name, path_list) abort
if ale#Var(a:buffer, a:base_var_name . '_use_global')
return ale#Var(a:buffer, a:base_var_name . '_executable')
endif
let l:nearest = ale#path#FindNearestExecutable(a:buffer, a:path_list)
if !empty(l:nearest)
return l:nearest
endif
return ale#Var(a:buffer, a:base_var_name . '_executable')
endfunction
" Return 1 if a path is an absolute path.
function! ale#path#IsAbsolute(filename) abort
if has('win32') && a:filename[:0] is# '\'