summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-05-01 22:43:44 +0100
committerGitHub <noreply@github.com>2019-05-01 22:43:44 +0100
commit5d65f9303326a2b6be0f3e0492a04277fb4f7376 (patch)
tree3bc65f43cff8d830e01c95a8660dd4bf7f427481 /autoload
parenteae124e8ce7d2503b7f803da6c450501dc4b7410 (diff)
parent99361b2ca92bb6b70056ee558088e386745435a6 (diff)
downloadale-5d65f9303326a2b6be0f3e0492a04277fb4f7376.zip
Merge pull request #2437 from robertjlooby/add-floskell
Add floskell for Haskell formatting
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/floskell.vim20
2 files changed, 25 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 45da359a..4d28272a 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -190,6 +190,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['hack'],
\ 'description': 'Fix Hack files with hackfmt.',
\ },
+\ 'floskell': {
+\ 'function': 'ale#fixers#floskell#Fix',
+\ 'suggested_filetypes': ['haskell'],
+\ 'description': 'Fix Haskell files with floskell.',
+\ },
\ 'hfmt': {
\ 'function': 'ale#fixers#hfmt#Fix',
\ 'suggested_filetypes': ['haskell'],
diff --git a/autoload/ale/fixers/floskell.vim b/autoload/ale/fixers/floskell.vim
new file mode 100644
index 00000000..f0015db7
--- /dev/null
+++ b/autoload/ale/fixers/floskell.vim
@@ -0,0 +1,20 @@
+" Author: robertjlooby <robertjlooby@gmail.com>
+" Description: Integration of floskell with ALE.
+
+call ale#Set('haskell_floskell_executable', 'floskell')
+
+function! ale#fixers#floskell#GetExecutable(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'haskell_floskell_executable')
+
+ return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'floskell')
+endfunction
+
+function! ale#fixers#floskell#Fix(buffer) abort
+ let l:executable = ale#fixers#floskell#GetExecutable(a:buffer)
+
+ return {
+ \ 'command': l:executable
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction