mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-03 01:53:30 +08:00
Merge pull request #1017 from carakan/elixir_format
`mix format` new fixer for elixir lang
This commit is contained in:
@@ -27,6 +27,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['javascript', 'typescript'],
|
||||
\ 'description': 'Apply eslint --fix to a file.',
|
||||
\ },
|
||||
\ 'mix_format': {
|
||||
\ 'function': 'ale#fixers#mix_format#Fix',
|
||||
\ 'suggested_filetypes': ['elixir'],
|
||||
\ 'description': 'Apply mix format to a file.',
|
||||
\ },
|
||||
\ 'format': {
|
||||
\ 'function': 'ale#fixers#format#Fix',
|
||||
\ 'suggested_filetypes': ['elm'],
|
||||
|
||||
16
autoload/ale/fixers/mix_format.vim
Normal file
16
autoload/ale/fixers/mix_format.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: carakan <carakan@gmail.com>
|
||||
" Description: Fixing files with elixir formatter 'mix format'.
|
||||
|
||||
call ale#Set('elixir_mix_executable', 'mix')
|
||||
|
||||
function! ale#fixers#mix_format#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'elixir_mix_executable')
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#mix_format#Fix(buffer) abort
|
||||
return {
|
||||
\ 'command': ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer))
|
||||
\ . ' format %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user