mirror of
https://github.com/dense-analysis/ale
synced 2024-12-27 08:32:24 +00:00
3b8ff6536e
* Adds phpactor lsp linter * Fixes missing comma * Adds tests for phpactor lsp linter * Adds note that this part is not my own work * Removes unused variable * Adds phpactor to supported tools list * Fixes doc sorting * Wraps phpactor in code tags
24 lines
730 B
VimL
24 lines
730 B
VimL
" Author: Arizard <https://github.com/Arizard>
|
|
" Description: PHPactor integration for ALE
|
|
|
|
" Copied from langserver.vim
|
|
function! ale_linters#php#phpactor#GetProjectRoot(buffer) abort
|
|
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
|
|
|
|
if (!empty(l:composer_path))
|
|
return fnamemodify(l:composer_path, ':h')
|
|
endif
|
|
|
|
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
|
|
|
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
|
endfunction
|
|
|
|
call ale#linter#Define('php', {
|
|
\ 'name': 'phpactor',
|
|
\ 'lsp': 'stdio',
|
|
\ 'executable': 'phpactor',
|
|
\ 'command': '%e language-server',
|
|
\ 'project_root': function('ale_linters#php#phpactor#GetProjectRoot'),
|
|
\})
|