summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <horacio@allm.net>2018-12-05 21:27:02 +0900
committerHoracio Sanson <horacio@allm.net>2018-12-05 21:53:39 +0900
commit3346b200bf6c3cb06359f3f0100d97559e707ddb (patch)
tree909591c0c36cc15138b01bb8cc6fd6c89e0735bf
parent92668b6beb9462f46b9e5d0126a33ee46dcb49cf (diff)
downloadale-3346b200bf6c3cb06359f3f0100d97559e707ddb.zip
Fix javalsp command.
The command used to invoke the LSP process was being escaped wrong. Also added a new option to set a different java executable and fixed the documentation.
-rw-r--r--ale_linters/java/javalsp.vim6
-rw-r--r--doc/ale-java.txt12
-rw-r--r--test/command_callback/test_javalsp_command_callback.vader6
3 files changed, 18 insertions, 6 deletions
diff --git a/ale_linters/java/javalsp.vim b/ale_linters/java/javalsp.vim
index 5d1a0c63..1436a52c 100644
--- a/ale_linters/java/javalsp.vim
+++ b/ale_linters/java/javalsp.vim
@@ -2,15 +2,17 @@
" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
call ale#Set('java_javalsp_jar', 'javacs.jar')
+call ale#Set('java_javalsp_executable', 'java')
function! ale_linters#java#javalsp#Executable(buffer) abort
- return 'java'
+ return ale#Var(a:buffer, 'java_javalsp_executable')
endfunction
function! ale_linters#java#javalsp#Command(buffer) abort
let l:jar = ale#Var(a:buffer, 'java_javalsp_jar')
+ let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
- return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main')
+ return ale#Escape(l:executable) . ' -cp ' . l:jar . ' -Xverify:none org.javacs.Main'
endfunction
call ale#linter#Define('java', {
diff --git a/doc/ale-java.txt b/doc/ale-java.txt
index 7bba12a3..8e40aea0 100644
--- a/doc/ale-java.txt
+++ b/doc/ale-java.txt
@@ -88,14 +88,20 @@ This generates a out/fat-jar.jar file that contains the language server. To
let ALE use this language server you need to set the g:ale_java_javalsp_jar
variable to the absolute path of this jar file.
+g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
+ *b:ale_java_javalsp_executable*
+ Type: |String|
+ Default: `'java'`
+
+This variable can be changed to use a different executable for java.
+
g:ale_java_javalsp_jar *g:ale_java_javalsp_jar*
*b:ale_java_javalsp_jar*
- Type: String
- Default: 'fat-jar.jar
+ Type: |String|
+ Default: `'fat-jar.jar'`
Path to the location of the vscode-javac language server plugin.
- and -d. They are added automatically.
===============================================================================
diff --git a/test/command_callback/test_javalsp_command_callback.vader b/test/command_callback/test_javalsp_command_callback.vader
index 1fbfddfb..aedb4a4b 100644
--- a/test/command_callback/test_javalsp_command_callback.vader
+++ b/test/command_callback/test_javalsp_command_callback.vader
@@ -6,5 +6,9 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The javalsp callback should return the correct default value):
- AssertLinter 'java', ale#Escape('java -cp javacs.jar -Xverify:none org.javacs.Main')
+ AssertLinter 'java', ale#Escape('java') . ' -cp javacs.jar -Xverify:none org.javacs.Main'
+Execute(The javalsp java executable should be configurable):
+ let b:ale_java_javalsp_executable = '/bin/foobar'
+
+ AssertLinter '/bin/foobar', ale#Escape('/bin/foobar') . ' -cp javacs.jar -Xverify:none org.javacs.Main'