summaryrefslogtreecommitdiff
path: root/ale_linters/reason/ls.vim
blob: a831b50650f1d886b59c89e9e333065e3105b283 (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
" Author: David Buchan-Swanson <github@deecewan.com>
" Description: Integrate ALE with reason-language-server.

call ale#Set('reason_ls_executable', '')

function! ale_linters#reason#ls#FindProjectRoot(buffer) abort
    let l:reason_config = ale#path#FindNearestFile(a:buffer, 'bsconfig.json')

    if !empty(l:reason_config)
        return fnamemodify(l:reason_config, ':h')
    endif

    return ''
endfunction

call ale#linter#Define('reason', {
\   'name': 'reason-language-server',
\   'aliases': ['reason_ls'],
\   'lsp': 'stdio',
\   'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')},
\   'command': '%e',
\   'project_root': function('ale_linters#reason#ls#FindProjectRoot'),
\   'language': 'reason',
\})