summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/appleswiftformat.vim
blob: ca27e82cde587de4dfc5794cbe51b1c6d37f94af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
" Author: (bosr) <bosr@bosr.cc>
" Description: Integration of apple/swift-format formatter with ALE.

function! ale#fixers#appleswiftformat#Fix(buffer) abort
    let l:command_args = ale#swift#GetAppleSwiftFormatCommand(a:buffer) . ' format --in-place %t'
    let l:config_args = ale#swift#GetAppleSwiftFormatConfigArgs(a:buffer)

    if l:config_args isnot# ''
        let l:command_args = l:command_args . ' ' . l:config_args
    endif

    return {
    \   'read_temporary_file': 1,
    \   'command': l:command_args,
    \}
endfunction