diff options
author | w0rp <devw0rp@gmail.com> | 2017-07-26 10:29:46 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-07-26 10:29:46 +0100 |
commit | 86297a7c65eadc5dc7668e129c92316aa0a89898 (patch) | |
tree | 03c3147fc90f16751c7b913effcb489f5597e071 /ale_linters | |
parent | e45c16d9bbcf7b9df09ce40ef467b13a49108487 (diff) | |
download | ale-86297a7c65eadc5dc7668e129c92316aa0a89898.zip |
Fix #804 - Do not run scalac for sbt files
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/scala/scalac.vim | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/ale_linters/scala/scalac.vim b/ale_linters/scala/scalac.vim index 4bc0cb8d..9262e625 100644 --- a/ale_linters/scala/scalac.vim +++ b/ale_linters/scala/scalac.vim @@ -1,6 +1,26 @@ -" Author: Zoltan Kalmar - https://github.com/kalmiz +" Author: Zoltan Kalmar - https://github.com/kalmiz, +" w0rp <devw0rp@gmail.com> " Description: Basic scala support using scalac +function! ale_linters#scala#scalac#GetExecutable(buffer) abort + if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0 + " Don't check sbt files with scalac. + return '' + endif + + return 'scalac' +endfunction + +function! ale_linters#scala#scalac#GetCommand(buffer) abort + let l:executable = ale_linters#scala#scalac#GetExecutable(a:buffer) + + if empty(l:executable) + return '' + endif + + return ale#Escape(l:executable) . ' -Ystop-after:parser %t' +endfunction + function! ale_linters#scala#scalac#Handle(buffer, lines) abort " Matches patterns line the following: " @@ -38,8 +58,8 @@ endfunction call ale#linter#Define('scala', { \ 'name': 'scalac', -\ 'executable': 'scalac', -\ 'output_stream': 'stderr', -\ 'command': 'scalac -Ystop-after:parser %t', +\ 'executable_callback': 'ale_linters#scala#scalac#GetExecutable', +\ 'command_callback': 'ale_linters#scala#scalac#GetCommand', \ 'callback': 'ale_linters#scala#scalac#Handle', +\ 'output_stream': 'stderr', \}) |