mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-16 01:07:06 +08:00
Add fourmolu fixer (#4501)
* Add fourmolu fixer Fourmolu is aversion of Ormolu that supports configuration. This fixer was modeled after the Ormolu one, but using the "stack executable" approach of the Brittany and Stylish Haskell fixers. * Sort supported-tools.md
This commit is contained in:
@@ -561,6 +561,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'A formatter for Haskell source code.',
|
||||
\ },
|
||||
\ 'fourmolu': {
|
||||
\ 'function': 'ale#fixers#fourmolu#Fix',
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'A formatter for Haskell source code.',
|
||||
\ },
|
||||
\ 'jsonnetfmt': {
|
||||
\ 'function': 'ale#fixers#jsonnetfmt#Fix',
|
||||
\ 'suggested_filetypes': ['jsonnet'],
|
||||
|
||||
20
autoload/ale/fixers/fourmolu.vim
Normal file
20
autoload/ale/fixers/fourmolu.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
call ale#Set('haskell_fourmolu_executable', 'fourmolu')
|
||||
call ale#Set('haskell_fourmolu_options', '')
|
||||
|
||||
function! ale#fixers#fourmolu#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_fourmolu_executable')
|
||||
|
||||
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'fourmolu')
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#fourmolu#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#fourmolu#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'haskell_fourmolu_options')
|
||||
|
||||
return {
|
||||
\ 'command': l:executable
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --stdin-input-file '
|
||||
\ . ale#Escape(@%),
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user