mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-30 22:55:30 +08:00
Split Hack out from PHP, modernize
fixes #1738 - Replace previous `hh_client` usage with LSP client - Add `HHAST` linter - Split Hack from PHP: Hack is increasingly diverging from PHP: - Hack tools do not understand PHP - Most PHP tools do not handle Hack code well (including vim's syntax highightling files) - http://github.com/hhvm/vim-hack now sets filetype to `hack`
This commit is contained in:
27
ale_linters/hack/hack.vim
Normal file
27
ale_linters/hack/hack.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" Author: Fred Emmott <fe@fb.com>
|
||||
" Description: Hack support via `hack lsp`
|
||||
|
||||
call ale#Set('hack_hhclient_executable', 'hh_client')
|
||||
|
||||
function! ale_linters#hack#hack#GetProjectRoot(buffer) abort
|
||||
let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig')
|
||||
return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#hack#hack#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'hack_hhclient_executable')
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#hack#hack#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#hack#hack#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable).' lsp --from vim-ale'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('hack', {
|
||||
\ 'name': 'hack',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#hack#hack#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#hack#hack#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#hack#hack#GetProjectRoot',
|
||||
\})
|
||||
Reference in New Issue
Block a user