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