summaryrefslogtreecommitdiff
path: root/autoload/ale/fixers/jsonnetfmt.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/fixers/jsonnetfmt.vim')
-rw-r--r--autoload/ale/fixers/jsonnetfmt.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/autoload/ale/fixers/jsonnetfmt.vim b/autoload/ale/fixers/jsonnetfmt.vim
new file mode 100644
index 00000000..f1e41cd5
--- /dev/null
+++ b/autoload/ale/fixers/jsonnetfmt.vim
@@ -0,0 +1,18 @@
+" Authors: Trevor Whitney <trevorjwhitney@gmail.com> and Takuya Kosugiyama <re@itkq.jp>
+" Description: Integration of jsonnetfmt with ALE.
+
+call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt')
+call ale#Set('jsonnet_jsonnetfmt_options', '')
+
+function! ale#fixers#jsonnetfmt#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_executable')
+ let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' -i'
+ \ . ale#Pad(l:options)
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction