diff options
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/lua_format.vim | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 0d110c79..728b6df7 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -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'], diff --git a/autoload/ale/fixers/lua_format.vim b/autoload/ale/fixers/lua_format.vim new file mode 100644 index 00000000..98b155c0 --- /dev/null +++ b/autoload/ale/fixers/lua_format.vim @@ -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 |