mirror of
https://github.com/amix/vimrc
synced 2025-09-14 07:35:01 +08:00
Updated plugins
This commit is contained in:
@ -1,28 +0,0 @@
|
||||
" Author: Zefei Xuan <https://github.com/zefei>
|
||||
" Description: Hack type checking (http://hacklang.org/)
|
||||
|
||||
function! ale_linters#php#hack#Handle(buffer, lines) abort
|
||||
let l:pattern = '^\(.*\):\(\d\+\):\(\d\+\),\(\d\+\): \(.\+])\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if a:buffer != bufnr(l:match[1])
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'hack',
|
||||
\ 'executable': 'hh_client',
|
||||
\ 'command': 'hh_client --retries 0 --retry-if-init false',
|
||||
\ 'callback': 'ale_linters#php#hack#Handle',
|
||||
\})
|
@ -4,16 +4,6 @@
|
||||
call ale#Set('php_langserver_executable', 'php-language-server.php')
|
||||
call ale#Set('php_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#php#langserver#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'php_langserver', [
|
||||
\ 'vendor/bin/php-language-server.php',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#langserver#GetCommand(buffer) abort
|
||||
return 'php ' . ale#Escape(ale_linters#php#langserver#GetExecutable(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#langserver#GetProjectRoot(buffer) abort
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
@ -23,7 +13,9 @@ endfunction
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'langserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#php#langserver#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#php#langserver#GetCommand',
|
||||
\ 'executable_callback': ale#node#FindExecutableFunc('php_langserver', [
|
||||
\ 'vendor/bin/php-language-server.php',
|
||||
\ ]),
|
||||
\ 'command': 'php %e',
|
||||
\ 'project_root_callback': 'ale_linters#php#langserver#GetProjectRoot',
|
||||
\})
|
||||
|
@ -3,26 +3,20 @@
|
||||
|
||||
let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
|
||||
|
||||
call ale#Set('php_phpcs_options', '')
|
||||
call ale#Set('php_phpcs_executable', 'phpcs')
|
||||
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#php#phpcs#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'php_phpcs', [
|
||||
\ 'vendor/bin/phpcs',
|
||||
\ 'phpcs'
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpcs#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#php#phpcs#GetExecutable(a:buffer)
|
||||
|
||||
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
|
||||
let l:standard_option = !empty(l:standard)
|
||||
\ ? '--standard=' . l:standard
|
||||
\ : ''
|
||||
let l:options = ale#Var(a:buffer, 'php_phpcs_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' -s --report=emacs --stdin-path=%s ' . l:standard_option
|
||||
return '%e -s --report=emacs --stdin-path=%s'
|
||||
\ . ale#Pad(l:standard_option)
|
||||
\ . ale#Pad(l:options)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
||||
@ -50,7 +44,10 @@ endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phpcs',
|
||||
\ 'executable_callback': 'ale_linters#php#phpcs#GetExecutable',
|
||||
\ 'executable_callback': ale#node#FindExecutableFunc('php_phpcs', [
|
||||
\ 'vendor/bin/phpcs',
|
||||
\ 'phpcs'
|
||||
\ ]),
|
||||
\ 'command_callback': 'ale_linters#php#phpcs#GetCommand',
|
||||
\ 'callback': 'ale_linters#php#phpcs#Handle',
|
||||
\})
|
||||
|
@ -6,16 +6,9 @@ let g:ale_php_phpmd_executable = get(g:, 'ale_php_phpmd_executable', 'phpmd')
|
||||
" Set to change the ruleset
|
||||
let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesize,controversial,design,naming,unusedcode')
|
||||
|
||||
function! ale_linters#php#phpmd#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'php_phpmd_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpmd#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#php#phpmd#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' %s text '
|
||||
\ . ale#Var(a:buffer, 'php_phpmd_ruleset')
|
||||
return '%e %s text'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'php_phpmd_ruleset'))
|
||||
\ . ' --ignore-violations-on-exit %t'
|
||||
endfunction
|
||||
|
||||
@ -39,7 +32,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phpmd',
|
||||
\ 'executable_callback': 'ale_linters#php#phpmd#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('php_phpmd_executable'),
|
||||
\ 'command_callback': 'ale_linters#php#phpmd#GetCommand',
|
||||
\ 'callback': 'ale_linters#php#phpmd#Handle',
|
||||
\})
|
||||
|
@ -6,20 +6,13 @@ let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpsta
|
||||
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4')
|
||||
let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
|
||||
|
||||
function! ale_linters#php#phpstan#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'php_phpstan_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpstan#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
|
||||
|
||||
let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
|
||||
let l:configuration_option = !empty(l:configuration)
|
||||
\ ? ' -c ' . l:configuration
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' analyze -l'
|
||||
return '%e analyze -l'
|
||||
\ . ale#Var(a:buffer, 'php_phpstan_level')
|
||||
\ . ' --errorFormat raw'
|
||||
\ . l:configuration_option
|
||||
@ -47,7 +40,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phpstan',
|
||||
\ 'executable_callback': 'ale_linters#php#phpstan#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('php_phpstan_executable'),
|
||||
\ 'command_callback': 'ale_linters#php#phpstan#GetCommand',
|
||||
\ 'callback': 'ale_linters#php#phpstan#Handle',
|
||||
\})
|
||||
|
Reference in New Issue
Block a user