mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-10 13:32:34 +08:00
Add support for lua-format fixer. (#3804)
This commit is contained in:
committed by
GitHub
parent
8b73d98baf
commit
1e9f40ff8d
@@ -441,6 +441,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||
\ 'description': 'Fix HTML files with html-beautify.',
|
||||
\ },
|
||||
\ 'lua-format': {
|
||||
\ 'function': 'ale#fixers#lua_format#Fix',
|
||||
\ 'suggested_filetypes': ['lua'],
|
||||
\ 'description': 'Fix Lua files with lua-format.',
|
||||
\ },
|
||||
\ 'luafmt': {
|
||||
\ 'function': 'ale#fixers#luafmt#Fix',
|
||||
\ 'suggested_filetypes': ['lua'],
|
||||
|
||||
16
autoload/ale/fixers/lua_format.vim
Normal file
16
autoload/ale/fixers/lua_format.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: Mathias Jean Johansen <mathias@mjj.io>
|
||||
" Description: Integration of LuaFormatter with ALE.
|
||||
|
||||
call ale#Set('lua_lua_format_executable', 'lua-format')
|
||||
call ale#Set('lua_lua_format_options', '')
|
||||
|
||||
function! ale#fixers#lua_format#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'lua_lua_format_executable')
|
||||
let l:options = ale#Var(a:buffer, 'lua_lua_format_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' -i',
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user