summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-08-18 18:28:58 +0100
committerw0rp <devw0rp@gmail.com>2019-08-18 18:29:59 +0100
commit73812c3e41c1c7fcf1705811f35ac4c9ccec003e (patch)
treea735617582e92bf09719d838fce49f058baceb73 /autoload
parent91636cff06c7fec4788ee83a26b11de46c9eabc8 (diff)
downloadale-73812c3e41c1c7fcf1705811f35ac4c9ccec003e.zip
Merge remote-tracking branch 'AlexeiDrake/master' into bugfix/c-lsp-build-dir-settings
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/hindent.vim20
2 files changed, 25 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 3850d782..7a553ccc 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -215,6 +215,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Fix Haskell files with brittany.',
\ },
+\ 'hindent': {
+\ 'function': 'ale#fixers#hindent#Fix',
+\ 'suggested_filetypes': ['haskell'],
+\ 'description': 'Fix Haskell files with hindent.',
+\ },
\ 'hlint': {
\ 'function': 'ale#fixers#hlint#Fix',
\ 'suggested_filetypes': ['haskell'],
diff --git a/autoload/ale/fixers/hindent.vim b/autoload/ale/fixers/hindent.vim
new file mode 100644
index 00000000..b6009a2c
--- /dev/null
+++ b/autoload/ale/fixers/hindent.vim
@@ -0,0 +1,20 @@
+" Author: AlexeiDrake <drake.alexei@gmail.com>
+" Description: Integration of hindent formatting with ALE.
+"
+call ale#Set('haskell_hindent_executable', 'hindent')
+
+function! ale#fixers#hindent#GetExecutable(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'haskell_hindent_executable')
+
+ return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hindent')
+endfunction
+
+function! ale#fixers#hindent#Fix(buffer) abort
+ let l:executable = ale#fixers#hindent#GetExecutable(a:buffer)
+
+ return {
+ \ 'command': l:executable
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction