diff options
author | David Wood <david@davidtw.co> | 2019-11-19 21:15:35 +0000 |
---|---|---|
committer | David Wood <david@davidtw.co> | 2020-10-23 11:48:21 +0100 |
commit | b496c4b1648cd15f8f6918d7c29853a8a04525c4 (patch) | |
tree | a02fc3092d358b4a7562c0b2aebe8b7e9118bdf1 /autoload | |
parent | 557a1ed5da70cb443a8650766f4e8ea95e8c0da3 (diff) | |
download | ale-b496c4b1648cd15f8f6918d7c29853a8a04525c4.zip |
Add ormolu fixer.
This commit adds a fixer for the Haskell language, ormolu
(https://github.com/tweag/ormolu).
Signed-off-by: David Wood <david@davidtw.co>
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 d71668f2..377edafd 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -380,6 +380,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 |