diff options
author | patrick brisbin <pbrisbin@gmail.com> | 2020-08-25 08:57:35 -0400 |
---|---|---|
committer | patrick brisbin <pbrisbin@gmail.com> | 2020-08-25 09:34:34 -0400 |
commit | 447aea4af045b80d63fafe4e65791aa6b7d5b21b (patch) | |
tree | 1f909fe3d474da40a41e8e8f50205e2a2b1306aa /autoload | |
parent | 3e2abe3f25493af63af91a6013447e378e09f6ec (diff) | |
download | ale-447aea4af045b80d63fafe4e65791aa6b7d5b21b.zip |
Add dhall-format as a Fixer
https://github.com/dhall-lang/dhall-lang
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/dhall.vim | 23 |
2 files changed, 28 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 2a38945c..d71668f2 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -375,6 +375,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['html', 'htmldjango'], \ 'description': 'Fix HTML files with html-beautify.', \ }, +\ 'dhall': { +\ 'function': 'ale#fixers#dhall#Fix', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Fix Dhall files with dhall-format.', +\ }, \} " Reset the function registry to the default entries. diff --git a/autoload/ale/fixers/dhall.vim b/autoload/ale/fixers/dhall.vim new file mode 100644 index 00000000..18f6006c --- /dev/null +++ b/autoload/ale/fixers/dhall.vim @@ -0,0 +1,23 @@ +" Author: Pat Brisbin <pbrisbin@gmail.com> +" Description: Integration of dhall-format with ALE. + +call ale#Set('dhall_format_executable', 'dhall') + +function! ale#fixers#dhall#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'dhall_format_executable') + + " Dhall is written in Haskell and commonly installed with Stack + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall') +endfunction + +function! ale#fixers#dhall#Fix(buffer) abort + let l:executable = ale#fixers#dhall#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' format' + \ . ' --inplace' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction |