summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/stylua.vim14
2 files changed, 19 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 1cd5b6ef..5a138484 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -441,6 +441,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['lua'],
\ 'description': 'Fix Lua files with luafmt.',
\ },
+\ 'stylua': {
+\ 'function': 'ale#fixers#stylua#Fix',
+\ 'suggested_filetypes': ['lua'],
+\ 'description': 'Fix Lua files with stylua.',
+\ },
\ 'ormolu': {
\ 'function': 'ale#fixers#ormolu#Fix',
\ 'suggested_filetypes': ['haskell'],
diff --git a/autoload/ale/fixers/stylua.vim b/autoload/ale/fixers/stylua.vim
new file mode 100644
index 00000000..3521c935
--- /dev/null
+++ b/autoload/ale/fixers/stylua.vim
@@ -0,0 +1,14 @@
+" Author: Robert Liebowitz <rliebz@gmail.com>
+" Description: https://github.com/johnnymorganz/stylua
+
+call ale#Set('lua_stylua_executable', 'stylua')
+call ale#Set('lua_stylua_options', '')
+
+function! ale#fixers#stylua#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'lua_stylua_executable')
+ let l:options = ale#Var(a:buffer, 'lua_stylua_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable) . ale#Pad(l:options) . ' -',
+ \}
+endfunction