summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorZack Kourouma <zack@kourouma.me>2017-10-24 14:29:04 -0700
committerw0rp <w0rp@users.noreply.github.com>2017-10-24 22:29:04 +0100
commit07dad64acb2ac67c3ccf5582995e3377d1479aa7 (patch)
tree4145496d27c551b79d489bb19a903937112b59ba /autoload
parentb172cd8b17a8d9f0573e75211963e59b37ad5c34 (diff)
downloadale-07dad64acb2ac67c3ccf5582995e3377d1479aa7.zip
adds fixer support for hfmt (#1027)
Add support for fixing Haskell with hfmt
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/hfmt.vim16
2 files changed, 21 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index e17521f4..bbdcc430 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -117,6 +117,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['rust'],
\ 'description': 'Fix Rust files with Rustfmt.',
\ },
+\ 'hfmt': {
+\ 'function': 'ale#fixers#hfmt#Fix',
+\ 'suggested_filetypes': ['haskell'],
+\ 'description': 'Fix Haskell files with hfmt.',
+\ },
\}
" Reset the function registry to the default entries.
diff --git a/autoload/ale/fixers/hfmt.vim b/autoload/ale/fixers/hfmt.vim
new file mode 100644
index 00000000..ea061da4
--- /dev/null
+++ b/autoload/ale/fixers/hfmt.vim
@@ -0,0 +1,16 @@
+" Author: zack <zack@kourouma.me>
+" Description: Integration of hfmt with ALE.
+
+call ale#Set('haskell_hfmt_executable', 'hfmt')
+
+function! ale#fixers#hfmt#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' -w'
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
+