Add raco_fmt fixer for Racket files (#4354)

* Add raco_fmt fixer for Racket files

* Fix command and add test

* Fix quoting
This commit is contained in:
Jeremy Cantrell
2022-11-07 07:20:25 -06:00
committed by GitHub
parent edffffac25
commit 4b433e5693
5 changed files with 39 additions and 0 deletions

View File

@@ -570,6 +570,11 @@ let s:default_registry = {
\ 'function': 'ale#fixers#zigfmt#Fix',
\ 'suggested_filetypes': ['zig'],
\ 'description': 'Official formatter for Zig',
\ },
\ 'raco_fmt': {
\ 'function': 'ale#fixers#raco_fmt#Fix',
\ 'suggested_filetypes': ['racket'],
\ 'description': 'Fix Racket files with raco fmt.',
\ }
\}

View File

@@ -0,0 +1,15 @@
" Author: Jeremy Cantrell <jmcantrell@gmail.com>
" Description: Integration of raco fmt with ALE.
call ale#Set('racket_raco_fmt_executable', 'raco')
call ale#Set('racket_raco_fmt_options', '')
function! ale#fixers#raco_fmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'racket_raco_fmt_executable')
let l:options = ale#Var(a:buffer, 'racket_raco_fmt_options')
return {
\ 'command': ale#Escape(l:executable) . ' fmt'
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction