From 62ea1dc2110ff760af167633c71a6e469011b9c6 Mon Sep 17 00:00:00 2001 From: Chris LaRose Date: Tue, 7 Apr 2020 11:05:54 -0700 Subject: Force reevaluation of autoformat settings at buffer write time --- autoload/prettier.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'autoload/prettier.vim') diff --git a/autoload/prettier.vim b/autoload/prettier.vim index ebe6abd..a9533f4 100644 --- a/autoload/prettier.vim +++ b/autoload/prettier.vim @@ -36,9 +36,15 @@ endfunction " Allows @format and @prettier pragma support upon saving function! prettier#Autoformat(...) abort - call prettier#Prettier(1, 1, line('$'), 0, { - \ 'requirePragma': g:prettier#autoformat_require_pragma ? 'true' : 'false' - \ }) + let l:autoformat = g:prettier#autoformat_config_present ? + \ prettier#IsConfigPresent(g:prettier#autoformat_config_files) : + \ g:prettier#autoformat + + if l:autoformat + call prettier#Prettier(1, 1, line('$'), 0, { + \ 'requirePragma': g:prettier#autoformat_require_pragma ? 'true' : 'false' + \ }) + endif endfunction " Main prettier command -- cgit v1.3-5-g9baa