2018-07-27 16:50:59 -04:00
|
|
|
" Author: Fred Emmott <fe@fb.com>
|
|
|
|
" Description: Hack support via `hack lsp`
|
|
|
|
|
2018-08-02 15:59:04 -04:00
|
|
|
call ale#Set('hack_hack_executable', 'hh_client')
|
2018-07-27 16:50:59 -04:00
|
|
|
|
|
|
|
function! ale_linters#hack#hack#GetProjectRoot(buffer) abort
|
|
|
|
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
|
2018-08-02 14:44:17 -04:00
|
|
|
|
2018-07-27 16:50:59 -04:00
|
|
|
return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! ale_linters#hack#hack#GetExecutable(buffer) abort
|
2018-08-02 15:59:04 -04:00
|
|
|
return ale#Var(a:buffer, 'hack_hack_executable')
|
2018-07-27 16:50:59 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('hack', {
|
|
|
|
\ 'name': 'hack',
|
|
|
|
\ 'lsp': 'stdio',
|
|
|
|
\ 'executable_callback': 'ale_linters#hack#hack#GetExecutable',
|
2018-08-02 15:59:04 -04:00
|
|
|
\ 'command': '%e lsp --from vim-ale',
|
2018-07-27 16:50:59 -04:00
|
|
|
\ 'project_root_callback': 'ale_linters#hack#hack#GetProjectRoot',
|
|
|
|
\})
|