@@ -27,6 +27,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['javascript', 'typescript'],
|
||||
\ 'description': 'Apply eslint --fix to a file.',
|
||||
\ },
|
||||
\ 'format': {
|
||||
\ 'function': 'ale#fixers#format#Fix',
|
||||
\ 'suggested_filetypes': ['elm'],
|
||||
\ 'description': 'Apply elm-format to a file.',
|
||||
\ },
|
||||
\ 'isort': {
|
||||
\ 'function': 'ale#fixers#isort#Fix',
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
|
||||
23
autoload/ale/fixers/format.vim
Normal file
23
autoload/ale/fixers/format.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Author: soywod <clement.douin@gmail.com>
|
||||
" Description: Integration of elm-format with ALE.
|
||||
|
||||
call ale#Set('elm_format_executable', 'elm-format')
|
||||
call ale#Set('elm_format_use_global', 0)
|
||||
call ale#Set('elm_format_options', '--yes')
|
||||
|
||||
function! ale#fixers#format#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_format', [
|
||||
\ 'node_modules/.bin/elm-format',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#format#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'elm_format_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#format#GetExecutable(a:buffer))
|
||||
\ . ' %t'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user