ale/ale_linters/hack/hack.vim

23 lines
720 B
VimL
Raw Permalink Normal View History

" 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')
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
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')
endfunction
call ale#linter#Define('hack', {
\ 'name': 'hack',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#hack#hack#GetExecutable'),
2018-08-02 19:59:04 +00:00
\ 'command': '%e lsp --from vim-ale',
\ 'project_root': function('ale_linters#hack#hack#GetProjectRoot'),
\})