mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-01 00:53:29 +08:00
adds fixer support for hfmt (#1027)
Add support for fixing Haskell with hfmt
This commit is contained in:
@@ -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.
|
||||
|
||||
16
autoload/ale/fixers/hfmt.vim
Normal file
16
autoload/ale/fixers/hfmt.vim
Normal file
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user