summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/sorbet.vim
blob: 7c12fa1ee49c2dc7bf9be4898d4b80c30a98925e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
call ale#Set('ruby_sorbet_executable', 'srb')
call ale#Set('ruby_sorbet_options', '')

function! ale#fixers#sorbet#GetCommand(buffer) abort
    let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable')
    let l:options = ale#Var(a:buffer, 'ruby_sorbet_options')

    return ale#ruby#EscapeExecutable(l:executable, 'srb')
    \   . ' tc'
    \   . (!empty(l:options) ? ' ' . l:options : '')
    \   . ' --autocorrect --file %t'
endfunction

function! ale#fixers#sorbet#Fix(buffer) abort
    return {
    \   'command': ale#fixers#sorbet#GetCommand(a:buffer),
    \   'read_temporary_file': 1,
    \}
endfunction