Improve eclipselsp jar search logic.

- Set default value to $HOME/eclipse.jdt.ls
 - Make JAR search regexp more specific.
 - Allow to set the VSCode extensions folder as ale_java_eclipselsp_path.
This commit is contained in:
Horacio Sanson
2019-05-08 11:46:19 +09:00
parent 63abd2dfef
commit 53db52e713
3 changed files with 26 additions and 17 deletions

View File

@@ -3,7 +3,7 @@
let s:version_cache = {}
call ale#Set('java_eclipselsp_path', 'eclipse.jdt.ls')
call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls'))
call ale#Set('java_eclipselsp_executable', 'java')
function! ale_linters#java#eclipselsp#Executable(buffer) abort
@@ -16,20 +16,27 @@ endfunction
function! ale_linters#java#eclipselsp#JarPath(buffer) abort
let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer)
let l:path = l:path . '/org.eclipse.jdt.ls.product/target/repository/plugins'
let l:files = globpath(l:path, 'org.eclipse.equinox.launcher_*.jar', 1, 1)
" Search jar file within repository path when manually built using mvn
let l:repo_path = l:path . '/org.eclipse.jdt.ls.product/target/repository'
let l:files = globpath(l:repo_path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
if empty(l:files)
return ''
if len(l:files) == 1
return l:files[0]
endif
return l:files[0]
" Search jar file within VSCode extensions folder.
let l:files = globpath(l:path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
if len(l:files) == 1
return l:files[0]
endif
return ''
endfunction
function! ale_linters#java#eclipselsp#ConfigurationPath(buffer) abort
let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer)
let l:path = l:path . '/org.eclipse.jdt.ls.product/target/repository'
let l:path = fnamemodify(ale_linters#java#eclipselsp#JarPath(a:buffer), ':p:h:h')
if has('win32')
let l:path = l:path . '/config_win'