summaryrefslogtreecommitdiff
path: root/ale_linters/scala/fsc.vim
blob: 17b26f0b21061ca87a04d3a7be848af3b76dfb2c (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
" Author: Nils Leuzinger - https://github.com/PawkyPenguin
" Description: Basic scala support using fsc
"
function! ale_linters#scala#fsc#GetExecutable(buffer) abort
    if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
        " Don't check sbt files
        return ''
    endif

    return 'fsc'
endfunction

function! ale_linters#scala#fsc#GetCommand(buffer) abort
    let l:executable = ale_linters#scala#fsc#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': 'fsc',
\   'executable_callback': 'ale_linters#scala#fsc#GetExecutable',
\   'command_callback': 'ale_linters#scala#fsc#GetCommand',
\   'callback': 'ale#handlers#scala#HandleScalacLintFormat',
\   'output_stream': 'stderr',
\})