summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-03-10 10:51:27 +0000
committerGitHub <noreply@github.com>2018-03-10 10:51:27 +0000
commit05d39bc1a9eb79ff6f36b190b4612ff052812e7e (patch)
tree654fb5c43e3bb6f8af5cf99df789362d332a0625
parentb586eba4a498af3ab156f59376344958d8d20db1 (diff)
parent9258c73680c7daa518a9a3bf2c4af6f5eb1b4b5e (diff)
downloadale-05d39bc1a9eb79ff6f36b190b4612ff052812e7e.zip
Merge pull request #1395 from gfontenot/gfontenot/fix-elm-format-name
Fix elm-format fixer name
-rw-r--r--autoload/ale/fix/registry.vim11
-rw-r--r--autoload/ale/fixers/elm_format.vim (renamed from autoload/ale/fixers/format.vim)6
-rw-r--r--test/fixers/test_elm_format_fixer_callback.vader10
3 files changed, 14 insertions, 13 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 3e407c52..fdd51019 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -23,6 +23,12 @@ let s:default_registry = {
\ 'description': 'Apply prettier-standard to a file.',
\ 'aliases': ['prettier-standard'],
\ },
+\ 'elm-format': {
+\ 'function': 'ale#fixers#elm_format#Fix',
+\ 'suggested_filetypes': ['elm'],
+\ 'description': 'Apply elm-format to a file.',
+\ 'aliases': ['format'],
+\ },
\ 'eslint': {
\ 'function': 'ale#fixers#eslint#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript'],
@@ -33,11 +39,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['elixir'],
\ 'description': 'Apply mix format 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'],
diff --git a/autoload/ale/fixers/format.vim b/autoload/ale/fixers/elm_format.vim
index be130f00..b2119d2c 100644
--- a/autoload/ale/fixers/format.vim
+++ b/autoload/ale/fixers/elm_format.vim
@@ -5,17 +5,17 @@ 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
+function! ale#fixers#elm_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
+function! ale#fixers#elm_format#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'elm_format_options')
return {
- \ 'command': ale#Escape(ale#fixers#format#GetExecutable(a:buffer))
+ \ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer))
\ . ' %t'
\ . (empty(l:options) ? '' : ' ' . l:options),
\ 'read_temporary_file': 1,
diff --git a/test/fixers/test_elm_format_fixer_callback.vader b/test/fixers/test_elm_format_fixer_callback.vader
index d613aa84..682c22ca 100644
--- a/test/fixers/test_elm_format_fixer_callback.vader
+++ b/test/fixers/test_elm_format_fixer_callback.vader
@@ -18,7 +18,7 @@ Execute(The elm-format command should have default params):
\ ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t --yes',
\ },
- \ ale#fixers#format#Fix(bufnr(''))
+ \ ale#fixers#elm_format#Fix(bufnr(''))
Execute(The elm-format command should manage use_global = 1 param):
call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
@@ -31,7 +31,7 @@ Execute(The elm-format command should manage use_global = 1 param):
\ ale#Escape('elm-format')
\ . ' %t --yes',
\ },
- \ ale#fixers#format#Fix(bufnr(''))
+ \ ale#fixers#elm_format#Fix(bufnr(''))
Execute(The elm-format command should manage executable param):
call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
@@ -45,7 +45,7 @@ Execute(The elm-format command should manage executable param):
\ ale#Escape('elmformat')
\ . ' %t --yes',
\ },
- \ ale#fixers#format#Fix(bufnr(''))
+ \ ale#fixers#elm_format#Fix(bufnr(''))
Execute(The elm-format command should manage empty options):
call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
@@ -58,7 +58,7 @@ Execute(The elm-format command should manage empty options):
\ ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t',
\ },
- \ ale#fixers#format#Fix(bufnr(''))
+ \ ale#fixers#elm_format#Fix(bufnr(''))
Execute(The elm-format command should manage custom options):
call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
@@ -71,4 +71,4 @@ Execute(The elm-format command should manage custom options):
\ ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t --param1 --param2',
\ },
- \ ale#fixers#format#Fix(bufnr(''))
+ \ ale#fixers#elm_format#Fix(bufnr(''))