summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/ocamlformat.vim
blob: 9b7c3e12da02729a60a28a0603132c6d805b898b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
" Author: Stephen Lumenta <@sbl>
" Description: Integration of ocamlformat with ALE.

call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat')
call ale#Set('ocaml_ocamlformat_options', '')

function! ale#fixers#ocamlformat#Fix(buffer) abort
    let l:filename = expand('#' . a:buffer . ':p')
    let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable')
    let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options')

    return {
    \   'command': ale#Escape(l:executable)
    \       . (empty(l:options) ? '' : ' ' . l:options)
    \       . ' --name=' . ale#Escape(l:filename)
    \       . ' -'
    \}
endfunction