summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorAhmed El Gabri <ahmed@gabri.me>2017-10-29 16:27:52 +0100
committerAhmed El Gabri <ahmed@gabri.me>2017-10-29 21:48:28 +0100
commit634eb1920cf6f22bf5a121928511ad873656b819 (patch)
tree8a298099151b8ece8c51d970cb87eaae9bb60b4a /autoload
parent1aa737cdc9b6e92b51823df93f356b4ec37beab3 (diff)
downloadale-634eb1920cf6f22bf5a121928511ad873656b819.zip
refmt fixer for ReasonML
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/refmt.vim18
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 5aa78ac5..37bbee9f 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -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.
diff --git a/autoload/ale/fixers/refmt.vim b/autoload/ale/fixers/refmt.vim
new file mode 100644
index 00000000..514f950a
--- /dev/null
+++ b/autoload/ale/fixers/refmt.vim
@@ -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