summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/purs_tidy.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/fixers/purs_tidy.vim')
-rw-r--r--autoload/ale/fixers/purs_tidy.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/autoload/ale/fixers/purs_tidy.vim b/autoload/ale/fixers/purs_tidy.vim
new file mode 100644
index 00000000..0183fd73
--- /dev/null
+++ b/autoload/ale/fixers/purs_tidy.vim
@@ -0,0 +1,26 @@
+" Author: toastal <toastal@posteo.net>
+" Description: Integration of purs-tidy with ALE.
+
+call ale#Set('purescript_tidy_executable', 'purs-tidy')
+call ale#Set('purescript_tidy_use_global', get(g:, 'ale_use_global_executables', 0))
+call ale#Set('purescript_tidy_options', '')
+
+function! ale#fixers#purs_tidy#GetExecutable(buffer) abort
+ return ale#path#FindExecutable(a:buffer, 'purescript_tidy', [
+ \ 'node_modules/purescript-tidy/bin/index.js',
+ \ 'node_modules/.bin/purs-tidy',
+ \])
+endfunction
+
+function! ale#fixers#purs_tidy#Fix(buffer) abort
+ let l:executable = ale#fixers#purs_tidy#GetExecutable(a:buffer)
+ let l:options = ale#Var(a:buffer, 'purescript_tidy_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ale#Pad(l:options)
+ \ . ' %s',
+ \ 'read_temporary_file': 0,
+ \}
+endfunction
+