Merge pull request #1395 from gfontenot/gfontenot/fix-elm-format-name

Fix elm-format fixer name
This commit is contained in:
w0rp 2018-03-10 10:51:27 +00:00 committed by GitHub
commit 05d39bc1a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 13 deletions

View File

@ -23,6 +23,12 @@ let s:default_registry = {
\ 'description': 'Apply prettier-standard to a file.', \ 'description': 'Apply prettier-standard to a file.',
\ 'aliases': ['prettier-standard'], \ 'aliases': ['prettier-standard'],
\ }, \ },
\ 'elm-format': {
\ 'function': 'ale#fixers#elm_format#Fix',
\ 'suggested_filetypes': ['elm'],
\ 'description': 'Apply elm-format to a file.',
\ 'aliases': ['format'],
\ },
\ 'eslint': { \ 'eslint': {
\ 'function': 'ale#fixers#eslint#Fix', \ 'function': 'ale#fixers#eslint#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript'], \ 'suggested_filetypes': ['javascript', 'typescript'],
@ -33,11 +39,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['elixir'], \ 'suggested_filetypes': ['elixir'],
\ 'description': 'Apply mix format to a file.', \ 'description': 'Apply mix format to a file.',
\ }, \ },
\ 'format': {
\ 'function': 'ale#fixers#format#Fix',
\ 'suggested_filetypes': ['elm'],
\ 'description': 'Apply elm-format to a file.',
\ },
\ 'isort': { \ 'isort': {
\ 'function': 'ale#fixers#isort#Fix', \ 'function': 'ale#fixers#isort#Fix',
\ 'suggested_filetypes': ['python'], \ 'suggested_filetypes': ['python'],

View File

@ -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_use_global', 0)
call ale#Set('elm_format_options', '--yes') 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', [ return ale#node#FindExecutable(a:buffer, 'elm_format', [
\ 'node_modules/.bin/elm-format', \ 'node_modules/.bin/elm-format',
\]) \])
endfunction 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') let l:options = ale#Var(a:buffer, 'elm_format_options')
return { return {
\ 'command': ale#Escape(ale#fixers#format#GetExecutable(a:buffer)) \ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer))
\ . ' %t' \ . ' %t'
\ . (empty(l:options) ? '' : ' ' . l:options), \ . (empty(l:options) ? '' : ' ' . l:options),
\ 'read_temporary_file': 1, \ 'read_temporary_file': 1,

View File

@ -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')) \ ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t --yes', \ . ' %t --yes',
\ }, \ },
\ ale#fixers#format#Fix(bufnr('')) \ ale#fixers#elm_format#Fix(bufnr(''))
Execute(The elm-format command should manage use_global = 1 param): Execute(The elm-format command should manage use_global = 1 param):
call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm') 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') \ ale#Escape('elm-format')
\ . ' %t --yes', \ . ' %t --yes',
\ }, \ },
\ ale#fixers#format#Fix(bufnr('')) \ ale#fixers#elm_format#Fix(bufnr(''))
Execute(The elm-format command should manage executable param): Execute(The elm-format command should manage executable param):
call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm') 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') \ ale#Escape('elmformat')
\ . ' %t --yes', \ . ' %t --yes',
\ }, \ },
\ ale#fixers#format#Fix(bufnr('')) \ ale#fixers#elm_format#Fix(bufnr(''))
Execute(The elm-format command should manage empty options): Execute(The elm-format command should manage empty options):
call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm') 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')) \ ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t', \ . ' %t',
\ }, \ },
\ ale#fixers#format#Fix(bufnr('')) \ ale#fixers#elm_format#Fix(bufnr(''))
Execute(The elm-format command should manage custom options): Execute(The elm-format command should manage custom options):
call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm') 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')) \ ale#Escape(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t --param1 --param2', \ . ' %t --param1 --param2',
\ }, \ },
\ ale#fixers#format#Fix(bufnr('')) \ ale#fixers#elm_format#Fix(bufnr(''))