mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-09 13:02:28 +08:00
Add support for Laravel Pint (#4238)
* add support, docs, tests for Laravel Pint * fix php-cs-fixer link * add missing project-without-pint * fix indentation * fix pint executable in pint fixer test * fix variables, docs related to pint support
This commit is contained in:
@@ -231,6 +231,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['php'],
|
||||
\ 'description': 'Fix PHP files with php-cs-fixer.',
|
||||
\ },
|
||||
\ 'pint': {
|
||||
\ 'function': 'ale#fixers#pint#Fix',
|
||||
\ 'suggested_filetypes': ['php'],
|
||||
\ 'description': 'Fix PHP files with Laravel Pint.',
|
||||
\ },
|
||||
\ 'astyle': {
|
||||
\ 'function': 'ale#fixers#astyle#Fix',
|
||||
\ 'suggested_filetypes': ['c', 'cpp'],
|
||||
|
||||
25
autoload/ale/fixers/pint.vim
Normal file
25
autoload/ale/fixers/pint.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" Author: Michael Dyrynda <michael@dyrynda.com.au>
|
||||
" Description: Fixing files with Laravel Pint.
|
||||
|
||||
call ale#Set('php_pint_executable', 'pint')
|
||||
call ale#Set('php_pint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('php_pint_options', '')
|
||||
|
||||
function! ale#fixers#pint#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'php_pint', [
|
||||
\ 'vendor/bin/pint',
|
||||
\ 'pint'
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#pint#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#pint#GetExecutable(a:buffer)
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . ale#Var(a:buffer, 'php_pint_options')
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user