mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-11 20:51:49 +08:00
Add stylua fixer for lua (#3789)
This commit is contained in:
@@ -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'],
|
||||
|
||||
14
autoload/ale/fixers/stylua.vim
Normal file
14
autoload/ale/fixers/stylua.vim
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user