summaryrefslogtreecommitdiff
path: root/ale_linters/java
diff options
context:
space:
mode:
authorHoracio Sanson <horacio@allm.net>2018-08-24 16:20:44 +0900
committerHoracio Sanson <horacio@allm.net>2018-08-24 16:28:15 +0900
commit3afff5a24c088988cd93529e62185f0dcc80da45 (patch)
tree15cdc1b3100e7b5faf7e3873f85e3ff6809b0fe3 /ale_linters/java
parent707b539969df55d9372135d8b15771693699d5ac (diff)
downloadale-3afff5a24c088988cd93529e62185f0dcc80da45.zip
Add vscode-java-language-server linter
Diffstat (limited to 'ale_linters/java')
-rw-r--r--ale_linters/java/javalsp.vim28
1 files changed, 28 insertions, 0 deletions
diff --git a/ale_linters/java/javalsp.vim b/ale_linters/java/javalsp.vim
new file mode 100644
index 00000000..fa1fe4cb
--- /dev/null
+++ b/ale_linters/java/javalsp.vim
@@ -0,0 +1,28 @@
+" Author: Horacio Sanson <https://github.com/hsanson>
+" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
+
+call ale#Set('java_javalsp_jar', 'javacs.jar')
+
+function! ale_linters#java#javalsp#Executable(buffer) abort
+ let l:jar = ale#VarFunc('java_javalsp_jar')(a:buffer)
+
+ if filereadable(l:jar)
+ return 'java'
+ endif
+
+ return ''
+endfunction
+
+function! ale_linters#java#javalsp#Command(buffer) abort
+ let l:jar = ale#VarFunc('java_javalsp_jar')(a:buffer)
+ return 'exec java -cp ' . l:jar . ' -Xverify:none org.javacs.Main'
+endfunction
+
+call ale#linter#Define('java', {
+\ 'name': 'javalsp',
+\ 'lsp': 'stdio',
+\ 'executable_callback': 'ale_linters#java#javalsp#Executable',
+\ 'command_callback': 'ale_linters#java#javalsp#Command',
+\ 'language': 'java',
+\ 'project_root_callback': 'ale#java#FindProjectRoot',
+\})