Merge pull request #2558 from hsanson/fix-javalsp-command-callback
Fix javalsp command callback.
This commit is contained in:
commit
1ba1a9ef0e
@ -1,7 +1,7 @@
|
|||||||
" Author: Horacio Sanson <https://github.com/hsanson>
|
" Author: Horacio Sanson <https://github.com/hsanson>
|
||||||
" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
|
" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
|
||||||
|
|
||||||
call ale#Set('java_javalsp_executable', 'java')
|
call ale#Set('java_javalsp_executable', '')
|
||||||
|
|
||||||
function! ale_linters#java#javalsp#Executable(buffer) abort
|
function! ale_linters#java#javalsp#Executable(buffer) abort
|
||||||
return ale#Var(a:buffer, 'java_javalsp_executable')
|
return ale#Var(a:buffer, 'java_javalsp_executable')
|
||||||
@ -10,7 +10,25 @@ endfunction
|
|||||||
function! ale_linters#java#javalsp#Command(buffer) abort
|
function! ale_linters#java#javalsp#Command(buffer) abort
|
||||||
let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
|
let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
|
||||||
|
|
||||||
return ale#Escape(l:executable) . ' -Xverify:none -m javacs/org.javacs.Main'
|
if fnamemodify(l:executable, ':t') is# 'java'
|
||||||
|
" For backward compatibility.
|
||||||
|
let l:cmd = [
|
||||||
|
\ ale#Escape(l:executable),
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.api=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.code=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.comp=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.main=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.tree=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.model=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.util=javacs',
|
||||||
|
\ '--add-opens jdk.compiler/com.sun.tools.javac.api=javacs',
|
||||||
|
\ '-m javacs/org.javacs.Main',
|
||||||
|
\]
|
||||||
|
|
||||||
|
return join(l:cmd, ' ')
|
||||||
|
else
|
||||||
|
return ale#Escape(l:executable)
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('java', {
|
call ale#linter#Define('java', {
|
||||||
|
@ -117,16 +117,19 @@ or
|
|||||||
|
|
||||||
This generates a dist/mac or dist/windows directory that contains the
|
This generates a dist/mac or dist/windows directory that contains the
|
||||||
language server. To let ALE use this language server you need to set the
|
language server. To let ALE use this language server you need to set the
|
||||||
g:ale_java_javalsp_executable variable to the absolute path of the java
|
g:ale_java_javalsp_executable variable to the absolute path of the launcher
|
||||||
executable in this directory.
|
executable in this directory.
|
||||||
|
|
||||||
g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
|
g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
|
||||||
*b:ale_java_javalsp_executable*
|
*b:ale_java_javalsp_executable*
|
||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'java'`
|
Default: `'launcher'`
|
||||||
|
|
||||||
This variable can be changed to use a different executable for java.
|
|
||||||
|
|
||||||
|
This variable must be set to the absolute path of the language server launcher
|
||||||
|
executable. For example:
|
||||||
|
>
|
||||||
|
let g:ale_java_javalsp_executable=/java-language-server/dist/mac/bin/launcher
|
||||||
|
<
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
eclipselsp *ale-java-eclipselsp*
|
eclipselsp *ale-java-eclipselsp*
|
||||||
|
@ -6,9 +6,26 @@ After:
|
|||||||
call ale#assert#TearDownLinterTest()
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
Execute(The javalsp callback should return the correct default value):
|
Execute(The javalsp callback should return the correct default value):
|
||||||
AssertLinter 'java', ale#Escape('java') . ' -Xverify:none -m javacs/org.javacs.Main'
|
AssertLinter '', ale#Escape('')
|
||||||
|
|
||||||
Execute(The javalsp java executable should be configurable):
|
Execute(The javalsp java executable should be configurable):
|
||||||
let b:ale_java_javalsp_executable = '/bin/foobar'
|
let b:ale_java_javalsp_executable = '/bin/foobar'
|
||||||
|
|
||||||
AssertLinter '/bin/foobar', ale#Escape('/bin/foobar') . ' -Xverify:none -m javacs/org.javacs.Main'
|
AssertLinter '/bin/foobar', ale#Escape('/bin/foobar')
|
||||||
|
|
||||||
|
Execute(The javalsp callback should return backward compatible value):
|
||||||
|
let b:ale_java_javalsp_executable = '/bin/java'
|
||||||
|
let cmd = [
|
||||||
|
\ ale#Escape('/bin/java'),
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.api=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.code=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.comp=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.main=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.tree=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.model=javacs',
|
||||||
|
\ '--add-exports jdk.compiler/com.sun.tools.javac.util=javacs',
|
||||||
|
\ '--add-opens jdk.compiler/com.sun.tools.javac.api=javacs',
|
||||||
|
\ '-m javacs/org.javacs.Main',
|
||||||
|
\]
|
||||||
|
AssertLinter '/bin/java', join(cmd, ' ')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user