summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-10-30 11:30:13 +0000
committerGitHub <noreply@github.com>2017-10-30 11:30:13 +0000
commit1575b3d7ddc5c2844d987f2abb0a5defe493972b (patch)
tree0fa6506730b54e319a45c7aa2a4eabe6811f950d /autoload
parentdaecbad543c68de1c0a2d8c368e4edde2f90461e (diff)
parent634eb1920cf6f22bf5a121928511ad873656b819 (diff)
downloadale-1575b3d7ddc5c2844d987f2abb0a5defe493972b.zip
Merge pull request #1059 from ahmedelgabri/reason-refmt
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