Merge pull request #2119 from hsanson/1994-fix-javalsp-support

Fix javalsp command.
This commit is contained in:
w0rp 2018-12-05 13:10:05 +00:00 committed by GitHub
commit dc61d46e28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View file

@ -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', {

View file

@ -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.
===============================================================================

View file

@ -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'