summaryrefslogtreecommitdiff
path: root/ale_linters/java/javalsp.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/java/javalsp.vim')
-rw-r--r--ale_linters/java/javalsp.vim14
1 files changed, 14 insertions, 0 deletions
diff --git a/ale_linters/java/javalsp.vim b/ale_linters/java/javalsp.vim
index f56675d6..baf584c8 100644
--- a/ale_linters/java/javalsp.vim
+++ b/ale_linters/java/javalsp.vim
@@ -2,11 +2,24 @@
" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
call ale#Set('java_javalsp_executable', '')
+call ale#Set('java_javalsp_config', {})
function! ale_linters#java#javalsp#Executable(buffer) abort
return ale#Var(a:buffer, 'java_javalsp_executable')
endfunction
+function! ale_linters#java#javalsp#Config(buffer) abort
+ let l:defaults = { 'java': { 'classPath': [], 'externalDependencies': [] } }
+ let l:config = ale#Var(a:buffer, 'java_javalsp_config')
+
+ " Ensure the config dictionary contains both classPath and
+ " externalDependencies keys to avoid a NPE crash on Java Language Server.
+ call extend(l:config, l:defaults, 'keep')
+ call extend(l:config['java'], l:defaults['java'], 'keep')
+
+ return l:config
+endfunction
+
function! ale_linters#java#javalsp#Command(buffer) abort
let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
@@ -38,4 +51,5 @@ call ale#linter#Define('java', {
\ 'command': function('ale_linters#java#javalsp#Command'),
\ 'language': 'java',
\ 'project_root': function('ale#java#FindProjectRoot'),
+\ 'lsp_config': function('ale_linters#java#javalsp#Config')
\})