summaryrefslogtreecommitdiff
path: root/ale_linters/java/eclipselsp.vim
diff options
context:
space:
mode:
authorGrim Kriegor <grimkriegor@krutt.org>2019-05-21 21:13:06 +0100
committerw0rp <w0rp@users.noreply.github.com>2019-05-21 21:13:06 +0100
commit0427ee84b4af77be84cbb005c26dc2142305fb73 (patch)
treeb7e78622533a6f2969374722256b2b447e97e5cf /ale_linters/java/eclipselsp.vim
parentf6ae056d02e82143f26db49b642d2f6d82d12cde (diff)
downloadale-0427ee84b4af77be84cbb005c26dc2142305fb73.zip
Allow running eclipselsp as installed by system package on GNU/Linux (#2523)
* Search eclipselsp jar and config files within system package path * Allow setting an alternate eclipselsp configuration directory * Add test for ale_java_eclipselsp_config_path
Diffstat (limited to 'ale_linters/java/eclipselsp.vim')
-rw-r--r--ale_linters/java/eclipselsp.vim13
1 files changed, 13 insertions, 0 deletions
diff --git a/ale_linters/java/eclipselsp.vim b/ale_linters/java/eclipselsp.vim
index d0ea9d6c..c0b476a3 100644
--- a/ale_linters/java/eclipselsp.vim
+++ b/ale_linters/java/eclipselsp.vim
@@ -4,6 +4,7 @@
let s:version_cache = {}
call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls'))
+call ale#Set('java_eclipselsp_config_path', '')
call ale#Set('java_eclipselsp_executable', 'java')
function! ale_linters#java#eclipselsp#Executable(buffer) abort
@@ -32,11 +33,23 @@ function! ale_linters#java#eclipselsp#JarPath(buffer) abort
return l:files[0]
endif
+ " Search jar file within system package path
+ let l:files = globpath('/usr/share/java/jdtls/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 = fnamemodify(ale_linters#java#eclipselsp#JarPath(a:buffer), ':p:h:h')
+ let l:config_path = ale#Var(a:buffer, 'java_eclipselsp_config_path')
+
+ if !empty(l:config_path)
+ return ale#path#Simplify(l:config_path)
+ endif
if has('win32')
let l:path = l:path . '/config_win'