File: php_cs_fixer.vim

package info (click to toggle)
vim-ale 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,764 kB
  • sloc: sh: 499; python: 311; perl: 31; makefile: 4; xml: 4; javascript: 1
file content (26 lines) | stat: -rw-r--r-- 914 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
" Author: Julien Deniau <julien.deniau@gmail.com>
" Description: Fixing files with php-cs-fixer.

call ale#Set('php_cs_fixer_executable', 'php-cs-fixer')
call ale#Set('php_cs_fixer_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('php_cs_fixer_options', '')
call ale#Set('php_cs_fixer_fix_options', '')

function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort
    return ale#path#FindExecutable(a:buffer, 'php_cs_fixer', [
    \   'vendor/bin/php-cs-fixer',
    \   'php-cs-fixer'
    \])
endfunction

function! ale#fixers#php_cs_fixer#Fix(buffer) abort
    let l:executable = ale#fixers#php_cs_fixer#GetExecutable(a:buffer)

    return {
    \   'command': ale#Escape(l:executable)
    \       . ' ' . ale#Var(a:buffer, 'php_cs_fixer_options')
    \       . ' fix ' . ale#Var(a:buffer, 'php_cs_fixer_fix_options')
    \       . ' %t',
    \   'read_temporary_file': 1,
    \}
endfunction