diff options
| author | Mitermayer Reis <mitermayer.reis@gmail.com> | 2017-12-28 10:43:33 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-28 10:43:33 -0800 |
| commit | 9b1180ba6d0ee77e4055c96bd50a0aa5e24aa845 (patch) | |
| tree | ed465e65e24fbe799433e59b97da721402daec0f | |
| parent | 32a17f75035a428e6630765b6ff1aeed594bd22f (diff) | |
| parent | b78cf3e319ed03edc1b49a6aca50a9f618cc4af7 (diff) | |
| download | vim-prettier-9b1180ba6d0ee77e4055c96bd50a0aa5e24aa845.tar.xz | |
Merge pull request #93 from prettier/bugfix/respecting-no-output-stdouts-from-prettier
bugfix - making sure we do not replace content with empty buffer
| -rw-r--r-- | autoload/prettier.vim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/autoload/prettier.vim b/autoload/prettier.vim index c929927..7325dfa 100644 --- a/autoload/prettier.vim +++ b/autoload/prettier.vim @@ -222,6 +222,11 @@ function! s:Apply_Prettier_Format(lines, startSelection, endSelection) abort let l:winview = winsaveview() let l:newBuffer = s:Get_New_Buffer(a:lines, a:startSelection, a:endSelection) + " we should not replace contents if the newBuffer is empty + if empty(l:newBuffer) + return + endif + " delete all lines on the current buffer silent! execute len(l:newBuffer) . ',' . line('$') . 'delete _' |
