mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-27 21:32:18 +08:00
add: support for rubyfmt as ruby fixer (#4678)
[rubyfmt](https://github.com/fables-tales/rubyfmt) is a formatter for `ruby` code. This commit adds support for `rubyfmt` as a `ruby` fixer (#2991), together with some tests and documentation.
This commit is contained in:
@@ -641,6 +641,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['nickel'],
|
||||
\ 'description': 'Fix nickel files with nickel format',
|
||||
\ },
|
||||
\ 'rubyfmt': {
|
||||
\ 'function': 'ale#fixers#rubyfmt#Fix',
|
||||
\ 'suggested_filetypes': ['ruby'],
|
||||
\ 'description': 'A formatter for Ruby source code',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
16
autoload/ale/fixers/rubyfmt.vim
Normal file
16
autoload/ale/fixers/rubyfmt.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: Yining <zhang.yining@gmail.com>
|
||||
" Description: support rubyfmt as ALE fixer for Ruby files
|
||||
|
||||
call ale#Set('ruby_rubyfmt_executable', 'rubyfmt')
|
||||
call ale#Set('ruby_rubyfmt_options', '')
|
||||
|
||||
function! ale#fixers#rubyfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rubyfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'ruby_rubyfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user