ale/ale_linters/hack/hack.vim

23 lines
718 B
VimL
Raw Normal View History

" 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')
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
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')
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',
\ 'project_root_callback': 'ale_linters#hack#hack#GetProjectRoot',
\})