File: mix_format.vim

package info (click to toggle)
vim-ale 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,764 kB
  • sloc: sh: 499; python: 311; perl: 31; makefile: 4; xml: 4; javascript: 1
file content (25 lines) | stat: -rw-r--r-- 866 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
" Author: carakan <carakan@gmail.com>, Fernando Mendes <fernando@mendes.codes>
" Description: Fixing files with elixir formatter 'mix format'.

call ale#Set('elixir_mix_executable', 'mix')
call ale#Set('elixir_mix_format_options', '')

function! ale#fixers#mix_format#GetExecutable(buffer) abort
    return ale#Var(a:buffer, 'elixir_mix_executable')
endfunction

function! ale#fixers#mix_format#GetCommand(buffer) abort
    let l:executable = ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer))
    let l:options = ale#Var(a:buffer, 'elixir_mix_format_options')

    return l:executable . ' format'
    \   . (!empty(l:options) ? ' ' . l:options : '')
    \   . ' %t'
endfunction

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