mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-15 15:46:52 +08:00
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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user