summaryrefslogtreecommitdiff
path: root/ale_linters/scala/scalac.vim
blob: 551284afe693b42a7f8d224fc1e726f78b1d4189 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
" 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',
\})