From b9fb62a4cd302486914403e41676e78b4cfdf0e3 Mon Sep 17 00:00:00 2001 From: Andrey Popp <8mayday@gmail.com> Date: Sun, 4 Nov 2018 20:10:36 +0300 Subject: Make ocamlformat work without temporary files Problem: ocamlformat is configured to format files in-place and thus go via creating a temporary file for that. Because temporary file resides in a different directory ocamlformat can't find `.ocamlformat` configuration files in an original location of source files. Solution: ocamlformat since version 0.8 can read sources on stdin and spur result on stdout. We reconfigure ocamlformat to use a simpler interface. --- autoload/ale/fixers/ocamlformat.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'autoload') diff --git a/autoload/ale/fixers/ocamlformat.vim b/autoload/ale/fixers/ocamlformat.vim index fac142aa..9b7c3e12 100644 --- a/autoload/ale/fixers/ocamlformat.vim +++ b/autoload/ale/fixers/ocamlformat.vim @@ -5,14 +5,14 @@ call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat') call ale#Set('ocaml_ocamlformat_options', '') function! ale#fixers#ocamlformat#Fix(buffer) abort + let l:filename = expand('#' . a:buffer . ':p') let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable') let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' --inplace' - \ . ' %t', - \ 'read_temporary_file': 1, + \ . ' --name=' . ale#Escape(l:filename) + \ . ' -' \} endfunction -- cgit v1.2.3