summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/fourmolu.vim
blob: 399ec0f43dbd9c72014b19da87708bd5dae325d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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