summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorMathias Jean Johansen <mathias@mjj.io>2021-07-09 16:54:43 +0200
committerGitHub <noreply@github.com>2021-07-09 23:54:43 +0900
commit1e9f40ff8d6a9d34fc84171e3cd416729b4506ec (patch)
tree1da3e605601c90bf2df06b1f77a4dfd3121c3cd5 /autoload
parent8b73d98baf0a185886a55a62b8b32f6543f14af4 (diff)
downloadale-1e9f40ff8d6a9d34fc84171e3cd416729b4506ec.zip
Add support for `lua-format` fixer. (#3804)
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/lua_format.vim16
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