From 40bf6e6b5c2cd8e5e23141254fa9f8bee5e6cd84 Mon Sep 17 00:00:00 2001 From: Horacio Sanson Date: Wed, 19 Jun 2019 11:38:23 +0900 Subject: Add support for javalsp configuration options. This MR adds a new configuration variable `g:ale_java_javalsp_config` that allows to configure external dependencies and class paths to the language server. The variable accepts a dictionary similar to the one supported by the [vscode/settings.json](https://github.com/georgewfraser/java-language-server#settings) file. Deprecates: #2561 --- ale_linters/java/javalsp.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'ale_linters/java') 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') \}) -- cgit v1.2.3