mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-31 08:34:30 +08:00
add cmake-format fixer support (#2244)
This commit is contained in:
@@ -145,6 +145,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['c', 'cpp'],
|
||||
\ 'description': 'Fix C/C++ files with clang-format.',
|
||||
\ },
|
||||
\ 'cmakeformat': {
|
||||
\ 'function': 'ale#fixers#cmakeformat#Fix',
|
||||
\ 'suggested_filetypes': ['cmake'],
|
||||
\ 'description': 'Fix CMake files with cmake-format.',
|
||||
\ },
|
||||
\ 'gofmt': {
|
||||
\ 'function': 'ale#fixers#gofmt#Fix',
|
||||
\ 'suggested_filetypes': ['go'],
|
||||
|
||||
18
autoload/ale/fixers/cmakeformat.vim
Normal file
18
autoload/ale/fixers/cmakeformat.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" Author: Attila Maczak <attila@maczak.hu>
|
||||
" Description: Integration of cmakeformat with ALE.
|
||||
|
||||
call ale#Set('cmake_cmakeformat_executable', 'cmake-format')
|
||||
call ale#Set('cmake_cmakeformat_options', '')
|
||||
|
||||
function! ale#fixers#cmakeformat#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cmake_cmakeformat_executable')
|
||||
let l:options = ale#Var(a:buffer, 'cmake_cmakeformat_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -i '
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user