2019-04-11 05:24:47 +00:00
|
|
|
" Author: David Buchan-Swanson <github@deecewan.com>
|
|
|
|
" Description: Integrate ALE with reason-language-server.
|
|
|
|
|
2019-06-08 23:12:11 +00:00
|
|
|
call ale#Set('reason_ls_executable', '')
|
|
|
|
|
|
|
|
function! ale_linters#reason#ls#FindProjectRoot(buffer) abort
|
2019-04-11 05:24:47 +00:00
|
|
|
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',
|
2023-09-13 23:38:12 +00:00
|
|
|
\ 'aliases': ['reason_ls'],
|
2019-04-11 05:24:47 +00:00
|
|
|
\ 'lsp': 'stdio',
|
2019-06-08 23:12:11 +00:00
|
|
|
\ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')},
|
2019-04-11 05:24:47 +00:00
|
|
|
\ 'command': '%e',
|
2019-06-08 23:12:11 +00:00
|
|
|
\ 'project_root': function('ale_linters#reason#ls#FindProjectRoot'),
|
2019-04-11 05:24:47 +00:00
|
|
|
\ 'language': 'reason',
|
|
|
|
\})
|