mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-25 12:26:51 +08:00
Add luafmt fixer (#3289)
This commit is contained in:
@@ -375,6 +375,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||
\ 'description': 'Fix HTML files with html-beautify.',
|
||||
\ },
|
||||
\ 'luafmt': {
|
||||
\ 'function': 'ale#fixers#luafmt#Fix',
|
||||
\ 'suggested_filetypes': ['lua'],
|
||||
\ 'description': 'Fix Lua files with luafmt.',
|
||||
\ },
|
||||
\ 'dhall': {
|
||||
\ 'function': 'ale#fixers#dhall#Fix',
|
||||
\ 'suggested_filetypes': ['dhall'],
|
||||
|
||||
13
autoload/ale/fixers/luafmt.vim
Normal file
13
autoload/ale/fixers/luafmt.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
call ale#Set('lua_luafmt_executable', 'luafmt')
|
||||
call ale#Set('lua_luafmt_options', '')
|
||||
|
||||
function! ale#fixers#luafmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'lua_luafmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'lua_luafmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --stdin',
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user