Fixes javalsp linter
This commit is contained in:
parent
0b9c0c2200
commit
5ce1e9b0b4
@ -1,7 +1,6 @@
|
|||||||
" 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_jar', 'javacs.jar')
|
|
||||||
call ale#Set('java_javalsp_executable', 'java')
|
call ale#Set('java_javalsp_executable', 'java')
|
||||||
|
|
||||||
function! ale_linters#java#javalsp#Executable(buffer) abort
|
function! ale_linters#java#javalsp#Executable(buffer) abort
|
||||||
@ -9,10 +8,9 @@ function! ale_linters#java#javalsp#Executable(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#java#javalsp#Command(buffer) abort
|
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)
|
let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
|
||||||
|
|
||||||
return ale#Escape(l:executable) . ' -cp ' . l:jar . ' -Xverify:none org.javacs.Main'
|
return ale#Escape(l:executable) . ' -Xverify:none -m javacs/org.javacs.Main'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('java', {
|
call ale#linter#Define('java', {
|
||||||
|
@ -79,14 +79,19 @@ g:ale_java_pmd_options *g:ale_java_pmd_options*
|
|||||||
javalsp *ale-java-javalsp*
|
javalsp *ale-java-javalsp*
|
||||||
|
|
||||||
To enable Java LSP linter you need to download and build the vscode-javac
|
To enable Java LSP linter you need to download and build the vscode-javac
|
||||||
language server from https://github.com/georgewfraser/vscode-javac. Simply
|
language server from https://github.com/georgewfraser/java-language-server.
|
||||||
download the source code and then build the plugin using maven:
|
Simply download the source code and then build a distribution:
|
||||||
|
|
||||||
mvn package
|
scripts/link_mac.sh
|
||||||
|
|
||||||
This generates a out/fat-jar.jar file that contains the language server. To
|
or
|
||||||
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.
|
scripts/link_windows.sh
|
||||||
|
|
||||||
|
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
|
||||||
|
g:ale_java_javalsp_executable variable to the absolute path of the java
|
||||||
|
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*
|
||||||
@ -95,14 +100,6 @@ g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
|
|||||||
|
|
||||||
This variable can be changed to use a different executable for 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'`
|
|
||||||
|
|
||||||
Path to the location of the vscode-javac language server plugin.
|
|
||||||
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
uncrustify *ale-java-uncrustify*
|
uncrustify *ale-java-uncrustify*
|
||||||
|
@ -6,9 +6,9 @@ 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') . ' -cp javacs.jar -Xverify:none org.javacs.Main'
|
AssertLinter 'java', ale#Escape('java') . ' -Xverify:none -m javacs/org.javacs.Main'
|
||||||
|
|
||||||
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') . ' -cp javacs.jar -Xverify:none org.javacs.Main'
|
AssertLinter '/bin/foobar', ale#Escape('/bin/foobar') . ' -Xverify:none -m javacs/org.javacs.Main'
|
||||||
|
Loading…
Reference in New Issue
Block a user