mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-30 14:45:29 +08:00
add uncrustify fixer for several languages
This commit is contained in:
@@ -235,6 +235,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['xml'],
|
||||
\ 'description': 'Fix XML files with xmllint.',
|
||||
\ },
|
||||
\ 'uncrustify': {
|
||||
\ 'function': 'ale#fixers#uncrustify#Fix',
|
||||
\ 'suggested_filetypes': ['c', 'cpp', 'cs', 'objc', 'objcpp', 'd', 'java', 'p', 'vala' ],
|
||||
\ 'description': 'Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
16
autoload/ale/fixers/uncrustify.vim
Normal file
16
autoload/ale/fixers/uncrustify.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: Derek P Sifford <dereksifford@gmail.com>
|
||||
" Description: Fixer for C, C++, C#, ObjectiveC, D, Java, Pawn, and VALA.
|
||||
|
||||
call ale#Set('c_uncrustify_executable', 'uncrustify')
|
||||
call ale#Set('c_uncrustify_options', '')
|
||||
|
||||
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)
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user