mirror of
https://github.com/dense-analysis/ale.git
synced 2026-08-03 22:48:30 +08:00
Add stylish-haskell as a fixer (#1837)
* Add stylish-haskell as a fixer `stylish-haskell` is a common formatting tool for the haskell toolchain. It is not as advanced as `brittany` or `hindent`, but it is commonly used for formatting of imports and data declarations. This adds it as a fixer in ALE.
This commit is contained in:
@@ -170,6 +170,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'Fix Haskell files with brittany.',
|
||||
\ },
|
||||
\ 'stylish-haskell': {
|
||||
\ 'function': 'ale#fixers#stylish_haskell#Fix',
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'Refactor Haskell files with stylish-haskell.',
|
||||
\ },
|
||||
\ 'refmt': {
|
||||
\ 'function': 'ale#fixers#refmt#Fix',
|
||||
\ 'suggested_filetypes': ['reason'],
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
" Author: eborden <evan@evan-borden.com>
|
||||
" Description: Integration of stylish-haskell formatting with ALE.
|
||||
"
|
||||
call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')
|
||||
|
||||
function! ale#fixers#stylish_haskell#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' --inplace'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user