diff options
author | w0rp <w0rp@users.noreply.github.com> | 2018-09-04 11:22:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-04 11:22:57 +0100 |
commit | 8f2e1c393f74326979e1c74af8dc9b6ca8004778 (patch) | |
tree | b7ff5762201d62333bf1757987434c50b3a5b72f /ale_linters | |
parent | 43b04d4e5b6205bf4456f333bf0595d32f82da6f (diff) | |
parent | 3d016f1697dd25443852d18a29a20c42c753dee1 (diff) | |
download | ale-8f2e1c393f74326979e1c74af8dc9b6ca8004778.zip |
Merge pull request #1871 from Ophirr33/master
added sbtserver linter
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/scala/sbtserver.vim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ale_linters/scala/sbtserver.vim b/ale_linters/scala/sbtserver.vim new file mode 100644 index 00000000..d75c38ca --- /dev/null +++ b/ale_linters/scala/sbtserver.vim @@ -0,0 +1,27 @@ +" Author: ophirr33 <coghlan.ty@gmail.com> +" Description: TCP lsp client for sbt Server + +call ale#Set('scala_sbtserver_address', '127.0.0.1:4273') +call ale#Set('scala_sbtserver_project_root', '') + +function! ale_linters#scala#sbtserver#GetProjectRoot(buffer) abort + let l:project_root = ale#Var(a:buffer, 'scala_sbtserver_project_root') + if l:project_root is? '' + let l:project_root = ale#path#FindNearestFile(a:buffer, 'build.sbt') + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' + endif + return l:project_root +endfunction + +function! ale_linters#scala#sbtserver#GetAddress(buffer) abort + let l:address = ale#Var(a:buffer, 'scala_sbtserver_address') + return l:address +endfunction + +call ale#linter#Define('scala', { +\ 'name': 'sbtserver', +\ 'lsp': 'socket', +\ 'address_callback': 'ale_linters#scala#sbtserver#GetAddress', +\ 'language': 'scala', +\ 'project_root_callback': 'ale_linters#scala#sbtserver#GetProjectRoot', +\}) |