Merge pull request #1059 from ahmedelgabri/reason-refmt

refmt fixer for ReasonML
This commit is contained in:
w0rp
2017-10-30 11:30:13 +00:00
committed by GitHub
7 changed files with 83 additions and 2 deletions

View File

@@ -127,6 +127,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Fix Haskell files with hfmt.',
\ },
\ 'refmt': {
\ 'function': 'ale#fixers#refmt#Fix',
\ 'suggested_filetypes': ['reason'],
\ 'description': 'Fix ReasonML files with refmt.',
\ },
\}
" Reset the function registry to the default entries.

View File

@@ -0,0 +1,18 @@
" Author: Ahmed El Gabri <@ahmedelgabri>
" Description: Integration of refmt with ALE.
call ale#Set('reasonml_refmt_executable', 'refmt')
call ale#Set('reasonml_refmt_options', '')
function! ale#fixers#refmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'reasonml_refmt_executable')
let l:options = ale#Var(a:buffer, 'reasonml_refmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --in-place'
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction