add terraform fmt fixer for terraform and hcl filetypes

See #1718
This commit is contained in:
Derek P Sifford committed 2018-10-23 20:44:31 -04:00
1 parent 2000436dfd
commit e94a594e2e
6 files changed
+88

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
" Author: dsifford <dereksifford@gmail.com>
" Description: Fixer for terraform and .hcl files
call ale#Set('terraform_fmt_executable', 'terraform')
call ale#Set('terraform_fmt_options', '')
function! ale#fixers#terraform#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'terraform_fmt_executable')
let l:options = ale#Var(a:buffer, 'terraform_fmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt'
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -'
\}
endfunction