ale/ale_linters/scala/scalac.vim
Nils Leuzinger 912f632bf5 Add fsc linter for Scala (#1452)
* Add fsc as a Scala linter

* Pull reused code into `autoload/ale/` directory

* Include fsc into the README

* Add unit test for testing the scala handler

* Add unit test for scala's fsc linter

* Rename scala unit tests for clarity

* Fix typo in README

* Fix typos in doc/ale.txt

* Fix author headline

* Put methods for fsc commands back into fsc.vim

* Move command_callback tests to correct location

* Rewrite handler test so it actually tests handler

* Clarify description of test in test_scala_handler
2018-04-05 21:04:11 +02:00

31 lines
916 B
VimL

" 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
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
call ale#linter#Define('scala', {
\ 'name': 'scalac',
\ 'executable_callback': 'ale_linters#scala#scalac#GetExecutable',
\ 'command_callback': 'ale_linters#scala#scalac#GetCommand',
\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
\ 'output_stream': 'stderr',
\})