@@ -223,6 +223,35 @@ function! lsp_settings#get(name, key, default) abort
223223endfunction 
224224
225225function !  lsp_settings#exec_path (cmd) abort 
226+ 
227+   if  get (g: ' lsp_settings_use_install_file' 0 ) ==  1 
228+     let  l: exec_path=  lsp_settings#find_from_install_dir (a: cmd
229+     if  l: exec_path!=  ' ' 
230+       return  l: exec_path
231+     endif 
232+   endif 
233+ 
234+   let  l: exec_path=  lsp_settings#find_from_path (a: cmd
235+   if  l: exec_path!=  ' ' 
236+     return  l: exec_path
237+   endif 
238+ 
239+   let  l: exec_path=  lsp_settings#find_from_extra_path (a: cmd
240+   if  l: exec_path!=  ' ' 
241+     return  l: exec_path
242+   endif 
243+ 
244+   if  get (g: ' lsp_settings_use_install_file' 0 ) ==  0 
245+     let  l: exec_path=  lsp_settings#find_from_install_dir (a: cmd
246+     if  l: exec_path!=  ' ' 
247+       return  l: exec_path
248+     endif 
249+   endif 
250+ 
251+   return  ' ' 
252+ endfunction 
253+ 
254+ function !  lsp_settings#find_from_path (cmd) abort 
226255  let  l: paths=  []
227256  if  has (' win32' 
228257    for  l: pathin  split ($PATH , ' ;' 
@@ -249,16 +278,32 @@ function! lsp_settings#exec_path(cmd) abort
249278      endif 
250279    endfor 
251280  endif 
281+   return  ' ' 
282+ endfunction 
252283
284+ function !  lsp_settings#find_from_extra_path (cmd) abort 
253285  let  l: paths=  get (g: ' lsp_settings_extra_paths' ' ' 
254286  if  type (l: paths==  type ([])
255287    let  l: paths=  join (l: paths' ,' ' ,' 
256288  endif 
257289  if  ! has (' win32' 
258-     let  l: paths.=  lsp_settings#servers_dir () . ' /' a: cmd
259290    return  lsp_settings#utils#first_one (globpath (l: pathsa: cmd1 ))
260291  endif 
261-   let  l: paths.=  lsp_settings#servers_dir () . ' \' a: cmd
292+   for  l: extin  [' .exe' ' .cmd' ' .bat' 
293+     let  l: path=  globpath (l: pathsa: cmdl: ext1 )
294+     if  ! empty (l: path
295+       return  lsp_settings#utils#first_one (l: path
296+     endif 
297+   endfor 
298+   return  ' ' 
299+ endfunction 
300+ 
301+ function !  lsp_settings#find_from_install_dir (cmd) abort 
302+   if  ! has (' win32' 
303+     let  l: paths=  lsp_settings#servers_dir () . ' /' a: cmd
304+     return  lsp_settings#utils#first_one (globpath (l: pathsa: cmd1 ))
305+   endif 
306+   let  l: paths=  lsp_settings#servers_dir () . ' \' a: cmd
262307  for  l: extin  [' .exe' ' .cmd' ' .bat' 
263308    let  l: path=  globpath (l: pathsa: cmdl: ext1 )
264309    if  ! empty (l: path
0 commit comments