mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-25 11:07:27 +08:00
Add support for erlfmt fixer (#3602)
* Add support for `erlfmt` * Add missing entry to table of contents * Fix warnings * Add missing tools to supported tools
This commit is contained in:
21
autoload/ale/fixers/erlfmt.vim
Normal file
21
autoload/ale/fixers/erlfmt.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Author: AntoineGagne - https://github.com/AntoineGagne
|
||||
" Description: Integration of erlfmt with ALE.
|
||||
|
||||
call ale#Set('erlang_erlfmt_executable', 'erlfmt')
|
||||
call ale#Set('erlang_erlfmt_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('erlang_erlfmt_options', '')
|
||||
|
||||
function! ale#fixers#erlfmt#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt'])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#erlfmt#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'erlang_erlfmt_options')
|
||||
let l:executable = ale#fixers#erlfmt#GetExecutable(a:buffer)
|
||||
|
||||
let l:command = ale#Escape(l:executable) . (empty(l:options) ? '' : ' ' . l:options) . ' %s'
|
||||
|
||||
return {
|
||||
\ 'command': l:command
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user