diff options
author | Evan Borden <eborden@users.noreply.github.com> | 2018-08-23 18:23:54 -0400 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2018-08-23 23:23:54 +0100 |
commit | 707b539969df55d9372135d8b15771693699d5ac (patch) | |
tree | ff86ab9bdc1160639e3ae4919defa98dad7b8ef4 /autoload | |
parent | 26005242744c6d88f0ec728964754909f4a73d94 (diff) | |
download | ale-707b539969df55d9372135d8b15771693699d5ac.zip |
Add hlint refactoring as a fixer (#1836)
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fix/registry.vim | 5 | ||||
-rw-r--r-- | autoload/ale/fixers/hlint.vim | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim index 60de4a46..dfcdc98f 100644 --- a/autoload/ale/fix/registry.vim +++ b/autoload/ale/fix/registry.vim @@ -170,6 +170,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with brittany.', \ }, +\ 'hlint': { +\ 'function': 'ale#fixers#hlint#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Refactor Haskell files with hlint.', +\ }, \ 'stylish-haskell': { \ 'function': 'ale#fixers#stylish_haskell#Fix', \ 'suggested_filetypes': ['haskell'], diff --git a/autoload/ale/fixers/hlint.vim b/autoload/ale/fixers/hlint.vim new file mode 100644 index 00000000..94dd736e --- /dev/null +++ b/autoload/ale/fixers/hlint.vim @@ -0,0 +1,16 @@ +" Author: eborden <evan@evan-borden.com> +" Description: Integration of hlint refactor with ALE. +" +call ale#Set('haskell_hlint_executable', 'hlint') + +function! ale#fixers#hlint#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' --refactor' + \ . ' --refactor-options="--inplace"' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction |