mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-12 21:21:50 +08:00
Fix 3998 - add language option to uncrustify fixer (#4007)
This commit is contained in:
@@ -4,13 +4,30 @@
|
||||
call ale#Set('c_uncrustify_executable', 'uncrustify')
|
||||
call ale#Set('c_uncrustify_options', '')
|
||||
|
||||
let s:languages = {
|
||||
\ 'c': 'C',
|
||||
\ 'cpp': 'CPP',
|
||||
\ 'cs': 'CS',
|
||||
\ 'objc': 'OC',
|
||||
\ 'objcpp': 'OC+',
|
||||
\ 'd': 'D',
|
||||
\ 'java': 'JAVA',
|
||||
\ 'vala': 'VALA',
|
||||
\ 'p': 'PAWN',
|
||||
\}
|
||||
|
||||
function! ale#fixers#uncrustify#Language(buffer) abort
|
||||
return get(s:languages, &filetype, 'C')
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#uncrustify#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'c_uncrustify_executable')
|
||||
let l:options = ale#Var(a:buffer, 'c_uncrustify_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' --no-backup'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --no-backup '
|
||||
\ . '-l' . ale#Pad(ale#fixers#uncrustify#Language(a:buffer))
|
||||
\ . ale#Pad(l:options)
|
||||
\}
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user