summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorCarlos Ramos <carakan@gmail.com>2017-10-20 17:13:25 -0400
committerCarlos Ramos <carakan@gmail.com>2017-10-22 19:20:38 -0400
commit43653ef54816e5219de56cf57073a93b4ce957b8 (patch)
tree79de0d705934c184fbc50bc7a413f59067ca5426 /autoload
parentc4579e1809d2ca40f917a4ccd665693ba0a33dcb (diff)
downloadale-43653ef54816e5219de56cf57073a93b4ce957b8.zip
new fixer elixir mix format
(only available in elixir > 1.6)
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/mix_format.vim17
-rw-r--r--autoload/ale/handlers/elixir.vim5
3 files changed, 27 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index d26c71ab..598be6d0 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -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'],
diff --git a/autoload/ale/fixers/mix_format.vim b/autoload/ale/fixers/mix_format.vim
new file mode 100644
index 00000000..905a6089
--- /dev/null
+++ b/autoload/ale/fixers/mix_format.vim
@@ -0,0 +1,17 @@
+" 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#handlers#elixir#GetExecutable(a:buffer)
+ \ . ale#fixers#mix_format#GetExecutable(a:buffer)
+ \ . ' format %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/handlers/elixir.vim b/autoload/ale/handlers/elixir.vim
new file mode 100644
index 00000000..be25d331
--- /dev/null
+++ b/autoload/ale/handlers/elixir.vim
@@ -0,0 +1,5 @@
+call ale#Set('elixir_executable', '')
+
+function! ale#handlers#elixir#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'elixir_executable')
+endfunction