diff options
| author | mitermayer <mitermayer.reis@gmail.com> | 2017-05-25 17:11:28 -0700 |
|---|---|---|
| committer | mitermayer <mitermayer.reis@gmail.com> | 2017-05-25 17:11:28 -0700 |
| commit | a1a66c9a90190b8199c25337925452465be8bf9c (patch) | |
| tree | 0906f94f8988f8a249ea66f294ee37bfb46c2954 /autoload/prettier.vim | |
| parent | 5077b05485e524f1e51fcb650984da4e728f1ba1 (diff) | |
| download | vim-prettier-a1a66c9a90190b8199c25337925452465be8bf9c.tar.xz | |
bugfix: Making sure that when prettier fail to parse buffer we do not
overwrite file with stdout output
Diffstat (limited to 'autoload/prettier.vim')
| -rw-r--r-- | autoload/prettier.vim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/autoload/prettier.vim b/autoload/prettier.vim index 3ec6cfb..deb25a7 100644 --- a/autoload/prettier.vim +++ b/autoload/prettier.vim @@ -10,6 +10,12 @@ function! prettier#Prettier() abort if exec != -1 let l:stdout = split(system(exec . s:Get_Prettier_Exec_Args(), getbufline(bufnr('%'), 1, '$')), '\n') + " check system exit code + if v:shell_error + echohl WarningMsg | echom 'Prettier: failed to parse buffer.' | echohl NONE + return + endif + " delete all lines on the current buffer silent! execute 1 . ',' . line('$') . 'delete _' |
