diff options
author | w0rp <w0rp@users.noreply.github.com> | 2020-11-21 20:25:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-21 20:25:13 +0000 |
commit | 96428425fe9ce8c5fa0718af2c6fe58deb61fadc (patch) | |
tree | 0cc28bc58977ef655e233967cf75decaf6c57781 /autoload | |
parent | 2873be2d6a5e383edd1fead396a53a8a38eebd76 (diff) | |
parent | b496c4b1648cd15f8f6918d7c29853a8a04525c4 (diff) | |
download | ale-96428425fe9ce8c5fa0718af2c6fe58deb61fadc.zip |
Merge pull request #2903 from davidtwco/ormolu-fixer
Add ormolu fixer.
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/ormolu.vim | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 9ea5331b..64e65214 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -385,6 +385,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['dhall'], \ 'description': 'Fix Dhall files with dhall-format.', \ }, +\ 'ormolu': { +\ 'function': 'ale#fixers#ormolu#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'A formatter for Haskell source code.', +\ }, \} " Reset the function registry to the default entries. diff --git a/autoload/ale/fixers/ormolu.vim b/autoload/ale/fixers/ormolu.vim new file mode 100644 index 00000000..69b55c1f --- /dev/null +++ b/autoload/ale/fixers/ormolu.vim @@ -0,0 +1,12 @@ +call ale#Set('haskell_ormolu_executable', 'ormolu') +call ale#Set('haskell_ormolu_options', '') + +function! ale#fixers#ormolu#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_ormolu_executable') + let l:options = ale#Var(a:buffer, 'haskell_ormolu_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction |